![](/img/trans.png)
[英]azure function queueTrigger error - Microsoft Azure WebJobs SDK '[Hidden Credential]' connection string is missing or empty
[英]Azure function with docker image throwing throws missing connection string error even though present
我有一個自定義 docker 圖像,我正在嘗試運行 azure 函數,我設法讓 function 運行,但代碼拋出以下錯誤
: Host.Startup[515]
A host error has occurred during startup operation '48758bfd-0fc4-4ac1-bcba-042a0338e561'.
System.InvalidOperationException: Microsoft Azure WebJobs SDK ServiceBus connection string 'analysis_SERVICEBUS' is missing or empty.
at Microsoft.Azure.WebJobs.ServiceBus.ServiceBusAccount.get_ConnectionString()
at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener..ctor(String functionId, EntityType entityType, String entityPath, Boolean isSessionsEnabled, ServiceBusTriggerExecutor triggerExecutor, ServiceBusOptions config, ServiceBusAccount serviceBusAccount, MessagingProvider messagingProvider, ILoggerFactory loggerFactory)
at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListenerFactory.CreateAsync(CancellationToken cancellationToken)
at Microsoft.Azure.WebJobs.ServiceBus.Triggers.ServiceBusTriggerBinding.CreateListenerAsync(ListenerFactoryContext context)
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.ListenerFactory.CreateAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs:line 426
at Microsoft.Azure.WebJobs.Host.Listeners.HostListenerFactory.CreateAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\HostListenerFactory.cs:line 67
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 45
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 103
at Microsoft.Azure.WebJobs.Script.ScriptHost.StartAsyncCore(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script/Host/ScriptHost.cs:line 256
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.UnsynchronizedStartHostAsync(ScriptHostStartupOperation activeOperation, Int32 attemptCount, JobHostStartupMode startupMode) in /src/azure-functions-host/src/WebJobs.Script.WebHost/WebJobsScriptHostService.cs:line 266
在我的 local.settings.json 我已經指定了連接字符串
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=false",
"FUNCTIONS_WORKER_RUNTIME": "node",
"UI_URL": "http://localhost:8080/report/",
"analysis_SERVICEBUS": "my connection string is listed here "
},
"Host": {
"LocalHttpPort": 9991,
"CORS": "*",
"CORSCredentials": false
}
}
我還需要對我的 docker 圖像做些什么來使代碼運行嗎?
在您的 json 配置中,您在 Values 下嵌套了 analysis_SERVICEBUS。 它應該在 json 的根目錄中。
{
"analysis_SERVICEBUS": "Endpoint=sb://xxxx="
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.