dotnet / dotnet/docs

IHostedService Under Load Balancer?

Open
#19,827 5 comments 0 reactions 0 assignees View on GitHub
:mag: Needs Research dotnet-architecture/svc microservices/subsvc waiting-on-feedback
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

# IHostedService Under Load Balancer

I read below line
"you can even make sure that it runs a single instance of that microservice process/container." but its confusing

I have multiple container and instance of my service under load balancer.

will this background job run in all instance or one among them??

if no how multiple instance inform that background process already started.

[edited by gewarren to add document details]

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: d49a03c0-a844-26eb-48a5-33a612dd3ead
* Version Independent ID: 0707865f-9db7-0d71-42a5-bc1a1e89680a
* Content: [Implement background tasks in microservices with IHostedService and the BackgroundService class](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/multi-container-microservice-net-applications/background-tasks-with-ihostedservice)
* Content Source: [docs/architecture/microservices/multi-container-microservice-net-applications/background-tasks-with-ihostedservice.md](https://github.com/dotnet/docs/blob/master/docs/architecture/microservices/multi-container-microservice-net-applications/background-tasks-with-ihostedservice.md)
* Product: **dotnet-architecture**
* Technology: **microservices**
* GitHub Login: @nishanil
* Microsoft Alias: **nanil**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.