【发布时间】:2020-03-27 14:13:12
【问题描述】:
我部署了基于 Java 的 Azure Functions 新版本。现在在 Azure 门户中我的 Azure 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
听起来有点像:https://github.com/Azure/azure-functions-host/issues/3363
有趣的是,在上次部署之前,除了一些小的 Java 代码更改外,我什么也没做。 Function App 版本是否自动更新?
我还通过 kudu 和日志流(应用程序日志)检查了日志。
日志:
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
日志流:
与通过 kudu 的日志文件中的日志相同
你知道它为什么停止工作吗?老实说,我没有计划。服务总线的任何配置是否触发了更改?
在 Azure 门户中检查解决方案 对于生产中的问题,请在打开错误之前在 Azure 门户中查看常见问题的解决方案。在 Azure 门户中,导航到您的函数应用 => 平台功能 => 诊断和解决问题以及相关仪表板,然后再打开您的问题。
调查信息 请提供以下信息:
时间戳:2019-12-02T18:21:46.680Z 函数应用版本(1.0 或 2.0):2.0.12888.0 (~2) 函数应用名称:functionapp-dtw-worker-dp-master 应用设置: FUNCTIONS_WORKER_RUNTIME:java 函数名称(视情况而定):serviceBusProcessor 会话 ID:a9f3c42dbb524ceca2c5158df9460c97 地区:西欧 相关信息 提供任何相关信息
使用的编程语言:Java with Spring Boot、Spring Cloud Functions 链接到来源 使用的绑定:ServiceBusTrigger、TimeTrigger
补充:我从这里将 .NET Core 版本等本地依赖项更新为最新的 v2.2.8:https://dotnet.microsoft.com/download/dotnet-core/2.2
更新不会更改错误消息。当我使用 maven 插件“azure-functions-maven-plugin”版本 1.3.4 在本地启动函数时,我得到了相同的错误异常,如下所示:
[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 问题报告:https://github.com/Azure/azure-functions-host/issues/5317
您对解决这些问题有什么建议吗?
【问题讨论】:
-
尝试将
Microsoft.Azure.ServiceBus的版本从3.0.2降级到2.7.6,看看能否解决这个错误。
标签: java azure azure-functions spring-cloud-function