WorkerConfig for runtime: dotnet-isolated not found

7.1k views Asked by At

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

5

There are 5 answers

1
SwethaKandikonda On

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.

0
Venkatesh Theerthala On

I had this issue when deployed to the azure, i had to remove this package to resolve the issue.

please try removing the package - Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator

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

0
dmcquiggin On

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

0
Michał Picheta On

try to move you entire catalog somewhere else (eg. C:\Work\Catalog\Apps\Working_App --> C:\Working_App) from and than open in VSCode. VSCode sometime confuses paths. I did like this and was able to deploy.

0
nmase88 On

I had this issue when running locally and it was actually just caused by a change in branch, cleaning the solution solved the problem for me. I know this won't be the answer for everyone, but hopefully someone else out there scratching their head will find this useful :-).