TGViewer
Programming & AI Tips 💡 Programming & AI Tips 💡 @programmingtip · 46.4K subscribers
Post #580 57.7K
Running async tasks on app startup in ASP.NET Core 3.0 ⚡️

In this post, I describe how a small change in the ASP.NET Core 3.0 WebHost makes it easier to run asynchronous tasks on app startup using IHostedService. ✅

Unfortunately, in 2.x it wasn't possible to use any of the built-in ASP.NET Core primitives to achieve this ❌ :

• IStartupFilter has a synchronous API, so would require doing sync over async. 🤦🏻‍♂️

• IApplicationLifetime has a synchronous API and raises the ApplicationStarted event after the server starts handling requests. 🤷🏻‍♂️

• IHostedService has an asynchronous API, but is executed after the server is started and starts handling requests. 👍🏻

With ASP.NET Core 3.0, a small change in the WebHost code makes a big difference - we no longer need these solutions, and can use IHostedService without the previous concerns❗️


[ Article ] : kutt.it/asphost

〰️〰️〰️〰️〰️〰️
#AspNet #AspMvc #AspCore
@ProgrammingTip
Telegram Programming Tips Resources
More from @programmingtip
  1. Oct 2, 2026GPT-6 Astra gets an Ultrafast API tier 🚀 OpenAI added an Ultrafast speed tier for GPT-6 A…
  2. Oct 1, 2026Cloudflare shipped an agentic CLI for its API ⚡️ Cloudflare launched cf, an agentic CLI fo…
  3. Sep 30, 2026OpenAI introduced Dots, always-on agents 🚀 OpenAI introduced Dots, its take on always-on…
  4. Sep 29, 2026Claude Sonnet 5.5 is built for coding agents 🚀 Anthropic released Claude Sonnet 5.5 for t…
  5. Sep 26, 2026Claude Opus 5.5 is available in the API 🚀 Anthropic released Claude Opus 5.5, and it is a…
  6. Sep 24, 2026Claude Opus 5.5 is now on the Claude Platform 🚀 Anthropic introduced Claude Opus 5.5, a l…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →