Skip to main content

Explain ASP.NET Core Application Lifetime events.

Senior .NET Core
Quick Answer IHostApplicationLifetime provides hooks: ApplicationStarted fires when the host is ready (warm caches, connect to message brokers). ApplicationStopping fires when shutdown is requested but before it completes (drain connections, stop background work). ApplicationStopped fires when everything is done. Inject it into any service that needs lifecycle awareness.

Answer

Lifetime events:

  • ApplicationStarted
  • ApplicationStopping
  • ApplicationStopped

They allow warm-ups, cache initialization, graceful shutdowns, and log flushing.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice