Do you mind being a bit more specific? Where exactly are you referring to?
For example, the below produces the same error.
using Volo.Abp;
using Volo.Abp.Autofac;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using WholesaleFriendly.MongoDB;
namespace WholesaleFriendly.Processor;
[DependsOn(typeof(WholesaleFriendlyMongoDbModule))]
[DependsOn(typeof(AbpIdentityApplicationModule))]
[DependsOn(typeof(AbpAutofacModule))]
public class AzureFunctionProcessorModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
}
}
The example you gave is for in-process worker functions. But I did update the code as follows, I am still getting an error on some modules, but the below works and I am able to inject IIdentityUserRepository and query it.
[Program.cs]
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Threading;
using Sample.SecondProcessor;
var host = new HostBuilder()
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.AddAppSettingsSecretsJson()
.UseAutofac()
.ConfigureContainer<ContainerBuilder>(builder =>
{
})
.ConfigureAppConfiguration((hostContext, config) =>
{
config.AddJsonFile("appsettings.json", optional: false);
})
.ConfigureServices(services =>
{
services.AddSingleton<ICancellationTokenProvider>(NullCancellationTokenProvider.Instance);
services.AddSingleton<IAbpLazyServiceProvider,AbpLazyServiceProvider>();
services.AddApplication<AzureFunctionProcessorModule>(x =>
{
x.UseAutofac();
});
var serviceProvider = services.BuildServiceProvider();
serviceProvider.GetRequiredService<IAbpApplicationWithExternalServiceProvider>().Initialize(serviceProvider);
})
.ConfigureFunctionsWorkerDefaults()
.Build();
host.Run();
[SampleModule.cs]
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain;
using Volo.Abp.Identity;
using Volo.Abp.Identity.MongoDB;
using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict.Tokens;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
using Sample.MongoDB;
namespace Sample.SecondProcessor;
[DependsOn(
typeof(AbpIdentityDomainModule),
typeof(AbpAutofacModule),
typeof(AbpIdentityMongoDbModule),
typeof(SampleApplicationContractsModule),
//typeof(SampleMongoDbModule)
)]
public class AzureFunctionProcessorModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient<IIdentityUserRepository, MongoIdentityUserRepository>();
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = false;
});
Configure<TokenCleanupOptions>(options =>
{
options.IsCleanupEnabled = false;
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
}
}
If I uncomment SampleMongoDbModule, it fails and I get the generic :
[2023-05-02T17:58:14.180Z] Language Worker Process exited. Pid=30853. [2023-05-02T17:58:14.180Z] dotnet exited with code 214 (0xD6). . [2023-05-02T17:58:14.277Z] Failed to start a new language worker for runtime: dotnet-isolated. [2023-05-02T17:58:14.277Z] System.Private.CoreLib: A task was canceled.
Otherwise it works. Also, most of the Pro modules fail with the same error. I thought it might be a license key issue? So I added .AddAppSettingsSecretsJson() and copied my key over. However, it still fails. Also note, that I had to set both IsJobExecutionEnabled and IsCleanupEnabled to false or else it would throw an exception as in the screenshot in my previous comment.
I believe this will work in In-process mode, but I don't want to have to downgrade my projects to NET 6.0.
That seemed to be the issue. Even though the appsettings.secret.json file was loaded, which I confirmed, the key was not being loaded. Copying the license key to appsettings.json works. The issue with isolated function apps is that many errors that are not in-code, are swallowed, and the above generic message is displayed. It's an issue that's been reported many times already. https://github.com/Azure/azure-functions-dotnet-worker/issues/532#issuecomment-1384065083
I might either create a gist or simple guide for this. I lost almost a week trying to get this to work :)
So are you saying don't use Angular for this? and just override what's in Themes/LeptonX/Layouts/Account in the MVC project?
Or are you saying that I would have to use the resource owner password flow if I want to do it in Angular?