My azure function is returning error: Azure Functions runtime is unreachable
System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types.
Method 'LogFunctionStarted' in type 'WebJobs.Host.Storage.Logging.PersistentQueueLogger' from assembly 'Microsoft.Azure.WebJobs.Host.Storage, Version=4.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Mapster.TypeAdapterConfig.<>c.b__87_0(Assembly assembly)
at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Mapster.TypeAdapterConfig.Scan(Assembly[] assemblies)
at DTSQuickHit.Functions.Startup.Configure(IFunctionsHostBuilder builder) at E:\buildagents\Agent03\_work\37\s\DTSQuickHit.Functions\Startup.cs : 32
my startup:
var environmentName = Environment.GetEnvironmentVariable("AZURE_FUNCTIONS_ENVIRONMENT");
var basePath = IsDevelopmentEnvironment(environmentName)
? environmentName
: $"{Environment.GetEnvironmentVariable("HOME")}\\site\\wwwroot";
var config = new ConfigurationBuilder()
.SetBasePath(basePath)
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
Microsoft.Azure.WebJobs.Host.Storage isnt even in my project files so I dont understand the problem.
My project files:
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.1.0" />
</ItemGroup>
Could you please help me out with solving this?
In case any solution related to the storage account setting in the function app is not working following can be the reason.
Your function worker runtime failed to start and now because Azure does some fancy stuff in the background to redeploy resources ASAP, it somehow binds the name of your function to the worker so it'll keep failing even if you redeploy.
The solution to this is to just scale the underlying app service plan to force the function site to start on a new worker. Once the scaling is done the worker runtime will be available again.
I hope this helps :)
When I got this issue, my Azure functions runtime is set to 4.x but my Microsoft.NET.Sdk.Functions
is at 3.0.13
when it should be at least 4.0.0
as stated on the Microsoft documentation. I just upgraded that package to the latest version and it worked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With