I deployed a new version of my Azure Functions based on Java. Now there is following error toast in the Azure portal under my Azure Function resource in a specific function:
Error: The function runtime is unable to start. Microsoft.Azure.WebJobs.ServiceBus: Could not load type 'Microsoft.Azure.ServiceBus.Management.ManagementClient' from assembly 'Microsoft.Azure.ServiceBus, Version=3.0.2.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c'. Session Id: a9f3c42dbb524ceca2c5158df9460c97 Timestamp: 2019-12-02T18:21:46.680Z
It sounds for me a bit like that: https://github.com/Azure/azure-functions-host/issues/3363
The interesting thing is that I changed nothing except some minor Java code changes till the last deployment. Is the Function App Version automatically updated?
I also checked the logs via kudu and log stream (application logs).
logs:
2019-12-02T11:08:04.412 [Information] Starting JobHost 2019-12-02T11:08:04.415 [Information] Starting Host (HostId=functionapp-dtw-worker-dp-master, InstanceId=aaab65a2-acef-4e4c-a8be-c3a1b13a795c, Version=2.0.12888.0, ProcessId=6860, AppDomainId=1, InDebugMode=True, InDiagnosticMode=False, FunctionsExtensionVersion=~2) 2019-12-02T11:08:04.467 [Information] Loading functions metadata 2019-12-02T11:08:04.495 [Information] 3 functions loaded 2019-12-02T11:08:04.812 [Information] Generating 3 job function(s) 2019-12-02T11:08:05.126 [Information] Found the following functions: Host.Functions.lastWillCronJobProcessor Host.Functions.serviceBusDeadLetterProcessor Host.Functions.serviceBusProcessor 2019-12-02T11:08:05.351 [Error] A host error has occurred during startup operation '7c3d76bc-730c-401a-86cb-27d04231d515'. System.TypeLoadException : Could not load type 'Microsoft.Azure.ServiceBus.Management.ManagementClient' from assembly 'Microsoft.Azure.ServiceBus, Version=3.0.2.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c'. at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusScaleMonitor..ctor(String functionId,EntityType entityType,String entityPath,String connectionString,Lazy1 receiver,ILoggerFactory loggerFactory)
at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener.<.ctor>b__18_0()
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication,Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener.GetMonitor() at Microsoft.Azure.WebJobs.Host.Listeners.HostListenerFactory.RegisterScaleMonitor(IListener listener,IScaleMonitorManager monitorManager) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\HostListenerFactory.cs : 107 at async Microsoft.Azure.WebJobs.Host.Listeners.HostListenerFactory.CreateAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\HostListenerFactory.cs : 69 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Host.Listeners.ListenerFactoryListener.StartAsyncCore(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\ListenerFactoryListener.cs : 45 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Host.Listeners.ShutdownListener.StartAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\ShutdownListener.cs : 29 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.JobHost.StartAsyncCore(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\JobHost.cs : 101 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.ScriptHost.StartAsyncCore(CancellationToken cancellationToken) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHost.cs : 249 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.UnsynchronizedStartHostAsync(ScriptHostStartupOperation activeOperation,Int32 attemptCount,JobHostStartupMode startupMode) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs : 235
Log streaming:
Same logs as in the log file via kudu
Do you know why it stopped working? I have no plan to be honest. Did any configuration for the service bus trigger changes?
Check for a solution in the Azure portal For issues in production, please check for a solution to common issues in the Azure portal before opening a bug. In the Azure portal, navigate to your function app => Platform features => Diagnose and solve problems and the relevant dashboards before opening your issue.
Investigative information Please provide the following:
Timestamp: 2019-12-02T18:21:46.680Z Function App version (1.0 or 2.0): 2.0.12888.0 (~2) Function App name: functionapp-dtw-worker-dp-master Application Setting: FUNCTIONS_WORKER_RUNTIME: java Function name(s) (as appropriate): serviceBusProcessor Session Id: a9f3c42dbb524ceca2c5158df9460c97 Region: West Europe Related information Provide any related information
Programming language used: Java with Spring Boot, Spring Cloud Functions Links to source Bindings used: ServiceBusTrigger, TimeTrigger
SUPPLEMENT: I updated the local dependencies like .NET Core Version to the newest v2.2.8 from here: https://dotnet.microsoft.com/download/dotnet-core/2.2
The update does not change the error message. I get the same error exception when I locally start the function with the maven plugin "azure-functions-maven-plugin" version 1.3.4, as you can see below:
[12/2/2019 10:44:26 PM] Starting JobHost [12/2/2019 10:44:26 PM] Starting Host (HostId=n900b368-1683948780, InstanceId=889e113f-9129-4a24-8fbf-9b560addd68e, Version=2.0.12888.0, ProcessId=2368, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=(null)) [12/2/2019 10:44:26 PM] Loading functions metadata [12/2/2019 10:44:26 PM] 3 functions loaded [12/2/2019 10:44:26 PM] Generating 3 job function(s) [12/2/2019 10:44:26 PM] Found the following functions: [12/2/2019 10:44:26 PM] Host.Functions.lastWillCronJobProcessor [12/2/2019 10:44:26 PM] Host.Functions.serviceBusDeadLetterProcessor [12/2/2019 10:44:26 PM] Host.Functions.serviceBusProcessor [12/2/2019 10:44:26 PM] [12/2/2019 10:44:26 PM] A host error has occurred during startup operation '03187631-f70a-45f5-9c3e-008568c4c6a4'. [12/2/2019 10:44:26 PM] Microsoft.Azure.WebJobs.ServiceBus: Could not load type 'Microsoft.Azure.ServiceBus.Management.ManagementClient' from assembly 'Microsoft.Azure.ServiceBus, Version=3.0.2.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c'. [12/2/2019 10:44:26 PM] Stopping JobHost
GitHub Issue Report: https://github.com/Azure/azure-functions-host/issues/5317
Do you have any suggestion to solve that problems?
Thank you for your hints and tips! I solved it via deleting the faulty bin directory. For more details, see: https://github.com/Azure/azure-functions-host/issues/5317
Excerpt from the solution from: https://github.com/Azure/azure-functions-host/issues/5317
I have set the Application Settings "WEBSITE_RUN_FROM_PACKAGE" to 1 and therefore I deployed a new version without bin directory and now it is working again. Thank you really much.
Detailed procedure for Azure Functions (Windows, Code, Java):
PS: I am using maven plugin for Azure Functions.
pom.xml:
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>1.3.4</version>
<plugin>