Azure Functions supports different execution models for .NET applications, and the choice affects how your application starts, handles dependencies, manages configuration, and interacts with the Functions runtime.

The isolated worker model separates your .NET application from the Azure Functions host process. This gives the application more control over its dependency injection, middleware, configuration, and runtime behavior.

Moving an existing function app from the in-process model to the isolated worker model is not simply a project file change. Function attributes, startup configuration, dependency injection, bindings, logging, and some APIs need to be reviewed.

This article walks through the migration process and the areas that usually require the most attention.

In-Process vs Isolated Worker

The main difference is where your application code executes.

In the in-process model, the function code runs inside the Azure Functions host process.

In the isolated worker model, your .NET application runs in a separate worker process.

The architecture can be represented as:

Code
In-Process

Azure Functions Host
        |
        +-- Your Function Code
        |
        +-- Dependencies

With the isolated model:

Code
Isolated Worker

Azure Functions Host
        |
        +-- Worker Process
                |
                +-- Your Function Code
                +-- Dependencies
                +-- Middleware

This separation provides more control over the application's .NET execution environment.

Area

In-Process

Isolated Worker

Application process

Functions host

Separate worker process

Dependency injection

Host-integrated

Application-controlled

Middleware

Limited

Supported

Configuration

Host-oriented

Application-oriented

Logging

Host integration

Standard .NET logging model

Startup

Functions startup model

Program.cs

Process isolation

No

Yes

The migration is therefore an application architecture change rather than a simple package upgrade.

Why Move to the Isolated Worker Model?

There are several reasons to migrate.

The isolated model provides a cleaner separation between your application and the Azure Functions host. It also aligns the function application more closely with the normal .NET application model.

This makes it easier to work with:

  • Dependency injection

  • Application configuration

  • Middleware

  • Custom services

  • Logging

  • Application startup

  • .NET libraries that expect standard application behavior

The isolated model can also reduce coupling between application code and the Functions host.

Start With the Project File

The first step is to review the .csproj file.

An in-process application commonly contains the WebJobs SDK packages.

For example:

HTML / XML
<ItemGroup>
  <PackageReference Include="Microsoft.NET.Sdk.Functions"
                    Version="..." />
</ItemGroup>

The isolated model uses the worker SDK instead.

A typical project includes:

HTML / XML
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Functions.Worker"
                      Version="..." />

    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk"
                      Version="..."
                      OutputItemType="Analyzer"
                      PrivateAssets="all" />

    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http"
                      Version="..." />
  </ItemGroup>

</Project>

The exact package versions should match the supported runtime and target framework used by your application.

The important difference is that the isolated worker project is an executable application and uses the worker SDK.

Add Program.cs

In-process applications commonly rely on the Functions host startup model.

The isolated worker uses normal .NET application startup.

A basic Program.cs can look like this:

C#
using Microsoft.Extensions.Hosting;

var builder = FunctionsApplication.CreateBuilder(args);

builder.ConfigureFunctionsWebApplication();

builder.Build().Run();

This becomes the entry point of the application.

That change is important because dependency registration and application configuration now happen through the normal application startup pipeline.

Move Dependency Injection to Program.cs

One of the biggest benefits of the isolated model is more direct control over dependency injection.

For example:

C#
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var builder = FunctionsApplication.CreateBuilder(args);

builder.Services.AddHttpClient();
builder.Services.AddSingleton<OrderService>();

builder.ConfigureFunctionsWebApplication();

builder.Build().Run();

A function can then receive the service through constructor injection:

C#
public class OrderFunction
{
    private readonly OrderService _orderService;

    public OrderFunction(OrderService orderService)
    {
        _orderService = orderService;
    }

    [Function("CreateOrder")]
    public async Task<HttpResponseData> Run(
        [HttpTrigger(AuthorizationLevel.Function, "post")]
        HttpRequestData request)
    {
        var result = await _orderService.CreateAsync();

        var response = request.CreateResponse(HttpStatusCode.OK);
        await response.WriteAsJsonAsync(result);

        return response;
    }
}

This is similar to dependency injection in other .NET application types.

Update Function Attributes

Function declarations need to be reviewed during migration.

For example, an HTTP function in the isolated model uses the worker namespace:

C#
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;

The function method uses:

C#
[Function("GetOrder")]

instead of the older in-process style.

The HTTP trigger can be declared as:

C#
[HttpTrigger(AuthorizationLevel.Function, "get")]
HttpRequestData request

The response is created through:

C#
HttpResponseData response = request.CreateResponse();

This is one of the most visible code changes during migration.

Replace HttpRequest and HttpResponse

In-process HTTP functions commonly use ASP.NET Core-style request and response objects.

For example:

C#
public IActionResult Run(
    [HttpTrigger(AuthorizationLevel.Function, "get")]
    HttpRequest req)
{
    return new OkObjectResult("Hello");
}

In the isolated worker model, the standard worker HTTP types are used:

C#
public HttpResponseData Run(
    [HttpTrigger(AuthorizationLevel.Function, "get")]
    HttpRequestData req)
{
    var response = req.CreateResponse(HttpStatusCode.OK);

    response.WriteString("Hello");

    return response;
}

This difference can affect helper methods, middleware, authentication logic, request headers, response handling, and tests.

Do not simply replace the type names. Review the surrounding HTTP code as well.

Review Binding Types

Bindings also need attention during migration.

For example, a queue-triggered function may look like:

C#
[Function("ProcessOrder")]
public async Task Run(
    [QueueTrigger("orders", Connection = "StorageConnection")]
    string message)
{
    await ProcessOrderAsync(message);
}

The trigger attribute comes from the worker extension package.

Make sure the required worker extension packages are installed for the bindings used by the application.

Typical bindings may include:

  • HTTP

  • Azure Storage

  • Service Bus

  • Event Hubs

  • Cosmos DB

  • Timer

  • Blob Storage

The migration should include an inventory of all bindings rather than only the HTTP functions.

Review Configuration

Configuration values accessed through environment variables generally continue to work, but configuration setup should be reviewed.

For example:

C#
var connectionString =
    Environment.GetEnvironmentVariable("StorageConnection");

For more structured applications, configuration can be registered during startup:

C#
builder.Configuration.AddJsonFile(
    "appsettings.json",
    optional: true,
    reloadOnChange: false);

Local development settings can remain in the local Functions configuration file.

Sensitive production values should continue to come from the appropriate Azure configuration and secret-management mechanism rather than being committed to source control.

Move Startup Logic Into Program.cs

If the existing application uses a Functions startup class, its responsibilities should be moved into the application's startup configuration.

For example, service registration that previously lived in startup code can move into:

C#
builder.Services.AddSingleton<IOrderRepository, OrderRepository>();
builder.Services.AddSingleton<OrderService>();

Configuration can be added through:

C#
builder.Configuration.AddEnvironmentVariables();

This makes application startup easier to understand because the service registration and application configuration are located in the normal entry point.

Add Middleware When Needed

The isolated worker model also makes middleware a useful option for cross-cutting concerns.

For example, request logging can be implemented as middleware:

C#
public class FunctionLoggingMiddleware : IFunctionsWorkerMiddleware
{
    private readonly ILogger<FunctionLoggingMiddleware> _logger;

    public FunctionLoggingMiddleware(
        ILogger<FunctionLoggingMiddleware> logger)
    {
        _logger = logger;
    }

    public async Task Invoke(
        FunctionContext context,
        FunctionExecutionDelegate next)
    {
        _logger.LogInformation(
            "Executing function {FunctionName}",
            context.FunctionDefinition.Name);

        await next(context);
    }
}

Register it during startup:

C#
builder.UseMiddleware<FunctionLoggingMiddleware>();

This is useful when the same behavior needs to apply across multiple functions.

Examples include:

  • Correlation IDs

  • Request logging

  • Custom exception handling

  • Common headers

  • Execution timing

  • Cross-cutting diagnostics

Review Logging

The isolated worker model uses the standard Microsoft.Extensions logging abstractions.

A function can receive an ILogger<T> through dependency injection:

C#
public class OrderFunction
{
    private readonly ILogger<OrderFunction> _logger;

    public OrderFunction(ILogger<OrderFunction> logger)
    {
        _logger = logger;
    }

    [Function("OrderFunction")]
    public void Run()
    {
        _logger.LogInformation("Processing order.");
    }
}

This makes logging code consistent with other .NET applications.

Avoid logging sensitive information such as access tokens, passwords, connection strings, or personal data.

Update Local Development

The local development configuration also needs to be checked.

Verify:

Code
local.settings.json
host.json
.csproj
Program.cs

The application should start successfully using the local Functions tooling.

Then test each trigger locally.

Do not assume that an application that compiles is ready for deployment.

Migration Checklist

A practical migration can be handled in stages.

  1. Identify the current target framework and Functions runtime.

  2. Inventory all triggers and bindings.

  3. Update the project file for the isolated worker model.

  4. Add the worker startup configuration.

  5. Move dependency injection into Program.cs.

  6. Update function attributes and namespaces.

  7. Replace incompatible HTTP request and response types.

  8. Review configuration and startup logic.

  9. Add or update middleware where required.

  10. Run unit and integration tests.

  11. Deploy to a non-production environment.

  12. Monitor function execution before production rollout.

This approach reduces the chance of discovering multiple unrelated migration problems at the same time.

Common Migration Mistakes

Updating Packages Without Updating Function Code

Changing package references alone is rarely enough.

Attributes, HTTP types, dependency injection, and startup behavior may also need changes.

Assuming HttpRequest Still Works

The isolated worker uses its own HTTP request and response abstractions unless you deliberately configure another integration approach.

Forgetting Worker Extension Packages

A migrated function may start successfully while a specific trigger fails because its worker extension package is missing or incompatible.

Keeping Old Startup Code

Move application configuration and service registration into the isolated application's startup path.

Do not leave obsolete startup patterns in place just because the project still compiles.

Testing Only One Function

A function app can contain several triggers with different dependencies.

Test each trigger type used by the application.

Advantages

The isolated worker model provides several useful architectural benefits:

  • Clear separation between the Functions host and application process

  • More control over dependency injection

  • Standard .NET application startup

  • Middleware support

  • Cleaner configuration patterns

  • Better separation of application dependencies

  • Easier integration with common .NET application patterns

For larger function applications, these differences can make the application structure easier to maintain.

Disadvantages

Migration also has costs.

Existing applications may require changes across many function classes, tests, binding packages, and startup components.

HTTP-heavy applications can require additional work because request and response types differ from the in-process model.

There can also be compatibility considerations for libraries that depend directly on in-process Functions APIs.

The safest approach is to migrate incrementally and test the application behavior rather than treating the migration as a simple dependency upgrade.

Troubleshooting

The Function Is Not Discovered

Check the project SDK, worker packages, target framework, and [Function] attributes.

Also verify that the generated function metadata is being created correctly during the build.

Dependency Injection Fails

Confirm that the service is registered in Program.cs:

C#
builder.Services.AddSingleton<MyService>();

Also check the constructor of the function class.

HTTP Response Behavior Changed

Review the conversion from IActionResult, HttpRequest, or HttpResponse to the isolated worker HTTP types.

Pay particular attention to headers, status codes, and JSON serialization.

A Binding Stops Working

Check the corresponding Microsoft.Azure.Functions.Worker.Extensions.* package and verify that the function uses the correct worker binding attribute.

Local Execution Works but Deployment Fails

Compare the local and Azure configuration.

Check application settings, connection strings, runtime configuration, deployed package contents, and worker configuration.

Best Practices

Area

Recommendation

Migration

Inventory triggers and dependencies first

Startup

Use Program.cs for application configuration

DI

Register services through IServiceCollection

HTTP

Review request and response handling

Bindings

Verify every worker extension package

Middleware

Use it for cross-cutting concerns

Testing

Test actual function triggers

Deployment

Validate in a non-production environment

Monitoring

Watch logs and failures after migration

Rollback

Keep the previous deployment available until validation is complete

The migration is easier when you treat it as an application modernization project rather than a package replacement exercise.

Summary

Moving an Azure Functions application from the in-process model to the isolated worker model changes more than the project file.

The main areas to review are:

SQL
Project File
    |
    +-- Worker Packages
    |
    +-- Program.cs
    |
    +-- Dependency Injection
    |
    +-- Function Attributes
    |
    +-- HTTP Types
    |
    +-- Bindings
    |
    +-- Configuration
    |
    +-- Middleware
    |
    +-- Tests

The isolated worker model provides a clearer separation between the Functions host and your .NET application and gives you more control over application startup, dependency injection, configuration, and middleware.

A successful migration starts with an inventory of the existing function app, updates the project and application code systematically, and validates every trigger before production deployment. The goal is not simply to make the project compile. The goal is to preserve the behavior of the existing application while moving it to a cleaner execution model.