How to Migrate Existing Azure Functions to the .NET 8 Isolated Worker Runtime

Written by thatrajeevkr | Published 2025/11/20
Tech Story Tags: azure-functions | .net | .net-8-isolated-worker | upgrade-azure-functions | dotnet-isolated-runtime | host.json-configuration | debugging-azure-functions | hackernoon-top-story

TLDRThis article walks through upgrading an existing Azure Functions project to the .NET 8 isolated worker model. It covers updating the project file, configuring host.json, replacing FunctionStartup with a Program.cs entry point, setting FUNCTIONS_WORKER_RUNTIME to dotnet-isolated, and correctly building, running, and attaching the debugger. By following these steps, you gain better performance, maintainability, and a smoother debugging experience for your serverless .NET workloads.via the TL;DR App

The .NET Isolated Worker Model allows developers to create Azure Functions using a .NET console app project that targets a supported .NET runtime. Compared to the in-process model, the Isolated Worker Model allows for greater flexibility, better performance, and improved debugging experience.


In this guide, I'll take you through upgrading your existing Azure Functions project to .NET 8, utilizing the isolated worker model.


Updating the .csproj File

The first step is converting the project file and updating dependencies.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
    <SdkVersion>1.18.1</SdkVersion>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.23.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="$(SdkVersion)" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Abstractions"
      Version="1.3.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="6.6.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
  </ItemGroup>

</Project>

Make the following changes:

  • Set <TargetFramework> to net8.0
  • Set <AzureFunctionsVersion> to v4.
  • Add <OutputType>Exe</OutputType>.

Updating the host.json File

Your host.json file plays a critical role in configuring the runtime behavior of your Azure Functions. Below is a sample configuration for an upgraded .NET 8 isolated function:

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


Updating the Program.cs File

The Program.cs file replaces FunctionStartup and serves as the application’s entry point.

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace FunctionApp
{
    class Program
    {
        static async Task Main(string[] args)
        {
            // #if DEBUG
            //     Debugger.Launch();
            // #endif
            //<docsnippet_startup>
            var host = new HostBuilder()
                //<docsnippet_configure_defaults>
                .ConfigureFunctionsWorkerDefaults()
                //</docsnippet_configure_defaults>
                //<docsnippet_dependency_injection>
                .ConfigureServices(s =>
                {
                    s.AddApplicationInsightsTelemetryWorkerService();
                    s.ConfigureFunctionsApplicationInsights();
                    s.Configure<LoggerFilterOptions>(options =>
                    {
                        // The Application Insights SDK adds a default logging filter that instructs ILogger to capture only Warning and more severe logs. Application Insights requires an explicit override.
                        // Log levels can also be configured using appsettings.json. For more information, see https://learn.microsoft.com/en-us/azure/azure-monitor/app/worker-service#ilogger-logs
                        LoggerFilterRule? toRemove = options.Rules.FirstOrDefault(rule => rule.ProviderName
                            == "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider");

                        if (toRemove is not null)
                        {
                            options.Rules.Remove(toRemove);
                        }
                    });
                })
                //</docsnippet_dependency_injection>
                .Build();
            //</docsnippet_startup>

            //<docsnippet_host_run>
            await host.RunAsync();
            //</docsnippet_host_run>
        }
    }
}

Updating local.settings.json

Modify FUNCTIONS_WORKER_RUNTIME to dotnet-isolated.


After you have done this, open up the terminal and run the following commands to build and debug the file. 

  • dotnet clean 
  • dotnet restore 
  • dotnet build
  • Try running the function using the command func start. If you are getting an error stating that it found 2 csproj file instead of 1 – that is the worker dependencies creating a csproj file, remove them by using the following command: Remove-Item -Recurse -Force obj Then run func start again, now it would run without any issues.  
  • Even though the DLL is running, the debugger is not attached, so your breakpoints won't be hit. In order to do that, after we have done the func start, we should attach the debugger. 
  • Click the green play button, which would create a prompt and ask to select the process for debugging, select the DLL of the project, and click it. Now the debugging is enabled, and your breakpoints will be hit.


By upgrading to the .NET 8 Isolated Worker Model, you improve the performance and maintainability of your Azure Functions. By going step-by-step through this guide, you can ensure that you follow the correct process while also taking advantage of the improvements in .NET and Azure Functions.


Written by thatrajeevkr | Another Software Developer solving technical problems one by one
Published by HackerNoon on 2025/11/20