Azure WebJob Timer Trigger启动失败:Settings需为name=value格式求助
Azure WebJob Timer Trigger启动失败:Settings must be of the form "name=value"
某特定Azure环境中运行带Timer Trigger的Azure WebJob时触发以下异常,其余测试环境正常运行,已初步检查存储连接字符串格式但未发现问题:
Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException: The listener for function 'SchedulerFunctions.RunEpTask' was unable to start. ---> System.FormatException: Settings must be of the form "name=value". at Microsoft.Azure.Storage.CloudStorageAccount.<>c. <Parse>b__97_0(String err) at Microsoft.Azure.Storage.CloudStorageAccount.ParseStringIntoSettings(String connectionString, Action`1 error) at Microsoft.Azure.Storage.CloudStorageAccount.ParseImpl(String connectionString, CloudStorageAccount& accountInformation, Action`1 error) at Microsoft.Azure.Storage.CloudStorageAccount.Parse(String connectionString) at Microsoft.Azure.WebJobs.Extensions.Timers.StorageScheduleMonitor.get_TimerStatusDirectory() in C:\azure-webjobs-sdk-extensions\src\WebJobs.Extensions\Extensions\Timers\Scheduling\StorageScheduleMonitor.cs:line 77 at Microsoft.Azure.WebJobs.Extensions.Timers.StorageScheduleMonitor.GetStatusBlobReference(String timerName) in C:\azure-webjobs-sdk-extensions\src\WebJobs.Extensions\Extensions\Timers\Scheduling\StorageScheduleMonitor.cs:line 144 at Microsoft.Azure.WebJobs.Extensions.Timers.StorageScheduleMonitor.GetStatusAsync(String timerName) in C:\azure-webjobs-sdk-extensions\src\WebJobs.Extensions\Extensions\Timers\Scheduling\StorageScheduleMonitor.cs:line 93 at Microsoft.Azure.WebJobs.Extensions.Timers.Listeners.TimerListener.StartAsync(CancellationToken cancellationToken) in C:\azure-webjobs-sdk-extensions\src\WebJobs.Extensions\Extensions\Timers\Listener\TimerListener.cs:line 99 at Microsoft.Azure.WebJobs.Host.Listeners.SingletonListener.StartAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Singleton\SingletonListener.cs:line 70 at Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener.StartAsync(CancellationToken cancellationToken, Boolean allowRetry) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs:line 68 --- End of inner exception stack trace --- at Microsoft.Azure.WebJobs.Host.RecoverableException.TryRecover(ILogger logger) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Exceptions\RecoverableException.cs:line 81 at Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener.StartAsync(CancellationToken cancellationToken, Boolean allowRetry) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs:line 79 at Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener.StartAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs:line 61 at Microsoft.Azure.WebJobs.Host.Listeners.CompositeListener.StartAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\CompositeListener.cs:line 39 at Microsoft.Azure.WebJobs.Host.Listeners.ListenerFactoryListener.StartAsyncCore(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\ListenerFactoryListener.cs:line 47 at Microsoft.Azure.WebJobs.Host.Listeners.ShutdownListener.StartAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\ShutdownListener.cs:line 29 at Microsoft.Azure.WebJobs.JobHost.StartAsyncCore(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\JobHost.cs:line 101 at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Deloitte.Audit.Workflow.NotificationService.Program.Main() in F:\Vsts\agent-15\_work\48\s\WebApi\src\Deloitte.Audit.Workflow.NotificationService\Program.cs:line 21 at Deloitte.Audit.Workflow.NotificationService.Program.<Main>()
排查与解决方案
清理连接字符串中的隐藏字符
复制连接字符串时可能带入全角空格、换行符、制表符等不可见字符,或首尾有多余空格。将字符串粘贴到Notepad++等工具,开启「显示所有字符」功能排查,重新复制干净的字符串到环境配置中。验证连接字符串格式完整性
Azure存储连接字符串标准格式为:DefaultEndpointsProtocol=https;AccountName=youraccount;AccountKey=yourkey;EndpointSuffix=core.windows.net确认每个键值对均为
name=value格式,无遗漏分号、等号,也没有非标准键名。检查应用设置的引号问题
如果通过Azure门户配置连接字符串,确认没有给整个字符串添加额外双引号——SDK会将引号作为字符串一部分解析,直接导致格式错误。排查Key Vault引用配置
若连接字符串通过Key Vault引用(如@Microsoft.KeyVault(SecretUri=...)),确认引用格式正确,且WebJob所在应用服务拥有Key Vault访问权限,同时密钥本身的连接字符串值无误。本地复现验证
将该环境的连接字符串复制到本地调试环境运行WebJob:若本地也报错,说明字符串本身存在问题;若本地正常,需排查Azure环境的配置冲突(如槽位设置与全局设置覆盖)。核对SDK版本一致性
确认该环境WebJob使用的Azure WebJobs SDK、Storage SDK版本与其他正常环境一致,不同版本的SDK对连接字符串的解析规则可能存在差异。
内容的提问来源于stack exchange,提问作者Debjoti
相关产品推荐
相关产品推荐

