---
title: "How to isolate Hangfire job processing into a separate Background Worker in ASP.NET Core?"  
description: "How to isolate Hangfire job processing into a separate Background Worker in ASP.NET Core?"  
author: "Manish Sharma"  
published: 2026-09-17  
updated: 2026-09-17  
canonical: https://www.mindstick.com/forum/162174/how-to-isolate-hangfire-job-processing-into-a-separate-background-worker-in-asp-net-core  
category: "Hangfire"  
tags: ["hangfire", "worker-service", "aspnet-core", "scalability", "microservices"]  
reading_time: 1 minute  

---

# How to isolate Hangfire job processing into a separate Background Worker in ASP.NET Core?

Currently, our **[ASP.NET Core Web API](https://www.mindstick.com/forum/239/net)** handles both user HTTP requests and heavy Hangfire background job executions. During peak hours, CPU usage spikes heavily, degrading API response times.

## Architecture Separation

We want to move the server component (job execution) into a standalone Worker Service project while keeping job creation inside the Web API project.

### Web API Enqueue Setup

```cs
// Enqueuing job from API endpoint without processing local jobs
app.MapPost("/api/reports", (IBackgroundJobClient jobClient) =>
{
    // Trigger background execution without running processing server locally
    jobClient.Enqueue(() => Console.WriteLine("Processing report..."));
    return Results.Accepted();
});
```

What is the best practice for sharing job interfaces and contract models between the API client project and the standalone worker service? How do we ensure that the Web API project only enqueues tasks without spawning a **[Background Processing](https://www.mindstick.com/blog/254/background-processing-in-android)** server instance?


---

Original Source: https://www.mindstick.com/forum/162174/how-to-isolate-hangfire-job-processing-into-a-separate-background-worker-in-asp-net-core

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
