Skip to main content
InterviewHubPRO
Section Overview
Q15

Question 15 of 50

Part 2: Entity Framework Core, Security & High-Performance Data (11 - 24)

30%
ASP.NET Core & Web API (50 Qs)•Part 2: Entity Framework Core, Security & High-Performance Data (11 - 24)

How do you implement Graceful Shutdown on .NET Web Apps?

junior LevelFormsPerformanceSecurity & Auth

In Simple Words: When receiving SIGTERM:

  1. Host triggers IHostApplicationLifetime.ApplicationStopping.
  2. Kestrel stops accepting new connections.
  3. In-flight requests are allowed to complete up to HostOptions.ShutdownTimeout (default 30s).
  4. IHostedService.StopAsync is invoked sequentially on all background workers.