Home > Software engineering >  Durable Function exception: "Unable to find an Azure Storage connection string to use for this
Durable Function exception: "Unable to find an Azure Storage connection string to use for this

Time:02-02

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.

CodePudding user response:

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.

CodePudding user response:

(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.

CodePudding user response:

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: Error message

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.

CodePudding user response:

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.

  • Related