The information provided in this repo is complementary to the issue Azure/azure-webjobs-sdk#2618.
The repo contains an example web job (see subfolder 'webjob') that reproduces a problem (which might be due to conflicting transient dependencies) when using azure webjobs sdk in conjunction with entity framework core and application insights.
The application is a console app with the following dependencies.
An exception is thrown during application startup.
Exception message:
System.MethodAccessException: 'Attempt by method 'Microsoft.Extensions.Logging.Configuration.LoggerProviderConfigurationFactory.GetConfiguration(System.Type)' to access method 'Microsoft.Extensions.Logging.ProviderAliasUtilities.GetAlias(System.Type)' failed.'
Callstack:
This exception was originally thrown at this call stack:
[External Code]
WebJobLibrary.WebJobHelper.Run(System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>) in WebJobHelper.cs
[External Code]
MyWebJob.Program.Main(string[]) in Program.cs
[External Code]
- The azure web jobs sdk must be wrapped in a library which is referenced from the actual web job
- Application insights must be initialized