Reputation: 1224
I have a Function App with a durable function (and some non-durable functions as well) and I'm getting an InvalidOperationException that says: Unable to find an Azure Storage connection string to use for this binding.
Here's the stacktrace:
System.InvalidOperationException:
at Microsoft.Azure.WebJobs.Extensions.DurableTask.DurableTaskExtension.GetOrchestrationServiceSettings (Microsoft.Azure.WebJobs.Extensions.DurableTask, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null)
at Microsoft.Azure.WebJobs.Extensions.DurableTask.DurableTaskExtension.Microsoft.Azure.WebJobs.Host.Config.IExtensionConfigProvider.Initialize (Microsoft.Azure.WebJobs.Extensions.DurableTask, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null)
at Microsoft.Azure.WebJobs.Host.Executors.JobHostConfigurationExtensions.InvokeExtensionConfigProviders (Microsoft.Azure.WebJobs.Host, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at Microsoft.Azure.WebJobs.Host.Executors.JobHostConfigurationExtensions.CreateStaticServices (Microsoft.Azure.WebJobs.Host, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at Microsoft.Azure.WebJobs.JobHost.InitializeServices (Microsoft.Azure.WebJobs.Host, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at Microsoft.Azure.WebJobs.Script.Utility.CreateMetadataProvider (Microsoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Utility.csMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 362)
at Microsoft.Azure.WebJobs.Script.ScriptHost.LoadBindingExtensions (Microsoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHost.csMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 966)
at Microsoft.Azure.WebJobs.Script.ScriptHost.Initialize (Microsoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHost.csMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 299)
at Microsoft.Azure.WebJobs.Script.ScriptHostManager.RunAndBlock (Microsoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHostManager.csMicrosoft.Azure.WebJobs.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 177)
It appears to be the durable function that's complaining about the missing connection string. However, I do have the connection string populated in my AzureWebJobsDashboard app setting, so I'm not sure why it's failing.
Upvotes: 5
Views: 19471
Reputation: 39
I've had everything needed and still getting the message. After 1 hour (or more) I got really pissed with the cause of it:
There is no specific error stating your local.settings.json is malformed, so I was simply missing a comma "," in my file after a rebase.
So, take another look at your local.settings.json, just to ensure everything is ok.
Upvotes: 3
Reputation: 33
I got this error after updating Microsoft.Azure.WebJobs from Nuget packages, then "AzureWebJobsStorage" will be an empty string like
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
Then go to your
local.settings.json
Then add this one
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
Hope it'll work.
Upvotes: 1
Reputation: 321
I was also facing the same issue. Updated Nuget pacakges, adding extentions didn't work, but after John answer, I figured it out what I was missing.
It got resolved as I didn't have local.settings.json
file so after adding it got resolved .
Attaching my local.setting.json which had the azureWebStotrage attribute.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
I hope someone finds this useful.
Upvotes: 3
Reputation: 301
As other answers have said, I was getting the exception due to the missing AzureWebJobsStorage
connection string. The connection string was, however, present in the appsettings.Development.json
file...
In order to get the Durable Function project to start up locally, the connection string needed to be in the local.settings.json
file.
Upvotes: 5
Reputation: 5048
This error is caused by an incorrect url. If the emulator is stopped, you get back: "No connection could be made because the target machine actively refused it" Refer to: Create your first durable function in C#
Resolutions:
1 - Ensure Azure Storage Emulator is working or restart it
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe stop
Windows Azure Storage Emulator 5.10.0.0 command line tool
The storage emulator was successfully stopped.
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe start
Windows Azure Storage Emulator 5.10.0.0 command line tool
The storage emulator was successfully started.
2: Ensure url is correct. The output contains several urls, make sure you take the one for statusQueryGetUri, (this is the most likely cause):
{"id":"57756e5133f047ed9213b3956c0268be",
"statusQueryGetUri":"http://localhost:7071/runtime/webhooks/durabletask/instances/57756e5133f047ed9213b3956c0268be?taskHub=TestHubName&connection=Storage&code=Ruk2CuiKU7yk9GM1qjalxynMwk2Bx2/KOpz78lxmPa4cNb2AtDZppw==",
"sendEventPostUri":"http://localhost:7071/runtime/webhooks/durabletask/instances/57756e5133f047ed9213b3956c0268be/raiseEvent/{eventName}?taskHub=TestHubName&connection=Storage&code=Ruk2CuiKU7yk9GM1qjalxynMwk2Bx2/KOpz78lxmPa4cNb2AtDZppw==",
"terminatePostUri":"http://localhost:7071/runtime/webhooks/durabletask/instances/57756e5133f047ed9213b3956c0268be/terminate?reason={text}&taskHub=TestHubName&connection=Storage&code=Ruk2CuiKU7yk9GM1qjalxynMwk2Bx2/KOpz78lxmPa4cNb2AtDZppw==",
"purgeHistoryDeleteUri":"http://localhost:7071/runtime/webhooks/durabletask/instances/57756e5133f047ed9213b3956c0268be?taskHub=TestHubName&connection=Storage&code=Ruk2CuiKU7yk9GM1qjalxynMwk2Bx2/KOpz78lxmPa4cNb2AtDZppw=="}
Working config file:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
Upvotes: 1
Reputation: 15052
(This question showed as not having an answer, so I'm taking Ling's suggestion and making it into a proper answer here)
In addition to the AzureWebJobsDashboard
app setting, you also need to specify your Azure Storage connection string in the AzureWebJobsStorage
app setting. The latter app setting is required by a variety of Azure Functions features, including Durable Functions. It's okay for the two app settings to have the same connection string.
Upvotes: 2