How to ensure the graceful IHostedService shutdown
I was seeing an issue recently where our application wasn’t running the StopAsync
method in our IHostedService
implementations when the app was shutting down. It turns out that this was due to some services taking too long to respond to the shutdown signal. In this post I show an example of the problem, discuss why it happens, and how to avoid it.
For more information, please read the original post:Extending the shutdown timeout setting to ensure graceful IHostedService shutdown.