WorkerConfig for runtime: dotnet-isolated not found

Viewed 2549

Created a .NET 6.0 Isolated Function (with HTTP Trigger) in Visual Studio 2022. But when running/debug this function locally, get following error:

Microsoft.Azure.WebJobs.Script: WorkerConfig for runtime: dotnet-isolated not found. Value cannot be null. (Parameter 'provider')

Error details from console:

enter image description here

Local.settings.json:

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
  }
}

host.json:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  }
}

.csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>    
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" OutputItemType="Analyzer" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
  </ItemGroup>
</Project>

Program.cs

using Microsoft.Extensions.Hosting;

var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults()
    .Build();

host.Run();

Project can be found in this GitHub Repo: FunctionAppTest

3 Answers

One of the workarounds is to add program.cs in your application and adding following references in your .csproj.

<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" OutputItemType="Analyzer" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="4.0.1" />

Make sure before you run the application try deleting the contents of your bin, Clean and Build your solution.

Try checking this similar thread.

I had experienced the same error message:

Microsoft.Azure.WebJobs.Script: WorkerConfig for runtime: dotnet-isolated not found.

This also occurred when deployed to Azure (in a Consumption Plan, but it seemed to be a general issue on Azure hosting).

The resolution for me was to update the nuget package related to the worker process, specifically Microsoft.Azure.Functions.Worker. The project created from the Functions template originally had a reference to version 1.6.0, and this exhibited the above error; upgrading to the latest, which as of the time of posting, is version 1.8.0, resolved all issues.

Both local debugging and publishing to Azure was successful, and the Function behaved as expected.

Microsoft.Azure.Functions.Worker versions

Related