Answer
IHostApplicationLifetime (renamed to IHostApplicationLifetime / IHostApplicationLifetime in newer versions) exposes three key notifications:
- ApplicationStarted – Fired when the app is fully started and ready to serve requests.
- ApplicationStopping – Fired when the app begins a graceful shutdown (e.g., SIGTERM in containers).
- ApplicationStopped – Fired when shutdown is complete and cleanup has finished.
These events are used to warm up caches, start or stop background tasks, flush logs, and release resources in cloud and container environments.