The Background on Background Tasks in .NET Core
summary
Compares concrete options: IHostedService, BackgroundService, Worker Service, and Hangfire with examples and pitfalls. Shows a Redis cache refresher running on a five‑second loop, explains that awaiting a long start in StartAsync blocks Kestrel from listening, and notes StopAsync gives about five seconds for graceful shutdown. Demonstrates Hangfire persisting jobs to SQL Server, a dashboard, automatic retries (default ten with exponential backoff) and concurrency limits. Covers worker services as a console template runnable as Windows Service or systemd and warns about idempotency when scaling out.
AI-written summary · about
chapters (20)
- 0:00Intro
- 2:35What problem do background tasks solve
- 7:18What is an IHostedService?
- 16:11How does an IHostedService work?
- 22:03What is a Background Service?
- 25:23How does a Background Service work?
- 28:10When do I use Background Service?
- 29:09When do I NOT use Background Service?
- 31:50What is a WorkerService?
- 36:17How does a WorkerService work?
- 36:46How do I host WorkerServices?
- 37:17When do I use WorkerServices?
- 38:28When do I NOT use WorkerServices?
- 40:12What is Hangfire?
- 48:47How does Hangfire work?
- 49:31When do I use Hangfire?
- 49:56When do I NOT use Hangfire?
- 50:34Cloud options
- 51:40Takeaways
- 51:59Resources
related talks
01h 06mThe Background on Background Tasks in .NET 6
50mA Deep Dive on Running Background Tasks in .NET Core
01h 00mBackground Services in ASP.NET Core and .NET
32mGrowing Your Background Job Knowledge
16mInterview Speaker – Alex Thissen
01h 11mTwelve Factor Apps in .NET : Building apps for the cloud
41mASP.NET Core in Production: Lessons Learned
40mToo… Much… Async… What to Watch for When Working with a Feature
