The Background on Background Tasks in .NET 6
summary
Demos cover four concrete approaches: IHostedService, BackgroundService, Worker Service, and Hangfire. Example implements a cache refresher backed by Redis and shows that IHostedService blocks startup if awaited, while BackgroundService cancels gracefully and avoids that footgun. Worker Service is the same background logic in a console app (host with systemd or Windows Service). Hangfire persists jobs to SQL Server or Redis, exposes a UI, and does Hangfire retries 10 times with exponential backoff and dead‑lettering; cloud options (Functions, Lambdas, Cloud Scheduler) are listed.
AI-written summary · about
chapters (13)
- 0:00Background tasks in .NET 6
- 1:03Background tasks use cases
- 8:00IHostedService deep dive
- 15:05IHostedService pros and cons
- 19:22BackgroundService explained
- 26:25When to use BackgroundService
- 29:57WorkerService introduction
- 34:14Hosting WorkerService
- 37:43HangFire overview
- 47:31HangFire features
- 50:43Cloud alternatives
- 55:18Messaging buses vs tasks
- 1:00:34Q&A
related talks
59mThe Background on Background Tasks in .NET Core
01h 00mTactics for Building Background Services in .NET
50mA Deep Dive on Running Background Tasks in .NET Core
01h 00mBackground Services in ASP.NET Core and .NET
32mGrowing Your Background Job Knowledge
58mBack to Basics: Efficient Async and Await
51mAsync Internals in .NET
01h 01mASP.NET Basics for Experts
