background-services

Installation
SKILL.md

Background Services in ASP.NET Core

Rationale

Background services are essential for offloading work from the request pipeline, processing queues, and handling scheduled tasks. Poorly implemented background services can lead to data loss, orphaned jobs, and resource leaks. These patterns ensure reliable, observable, and gracefully degrading background processing in production applications.


BackgroundService vs IHostedService

Feature BackgroundService IHostedService
Purpose Long-running loop or continuous work Startup/shutdown hooks
Methods Override ExecuteAsync Implement StartAsync + StopAsync
Lifetime Runs until cancellation or host shutdown StartAsync runs at startup, StopAsync at shutdown
Use when Polling queues, processing streams, periodic jobs Database migrations, cache warming, resource cleanup

Installs
53
GitHub Stars
61
First Seen
Mar 7, 2026
background-services — wshaddix/dotnet-skills