简体   繁体   中英

What timeouts govern worker process shutdown when stopping an application pool

I have an ASP.NET (.NET Framework) site running in IIS. The site has a long-running background process and when the application pool is stopped as part of tearning down an active VM I'd like for the w3wp process to continue running until the background process shuts down gracefully (which can take a long time).

We leverage a custom IRegisteredObject to plug into ASP.NET shutdown; our code does not return from the Stop(true) call until the background process shuts down.

When we stop the application pool, we see in our logs that Stop(false) is called and then Stop(true) is called 30s later like we expect. However, before Stop(true) returns IIS is simply killing the worker process. This kill happens five minutes after the initial Stop(false) call. We'd like to extend this timeout.

In IIS itself, we have App pool->Process Model->Shutdown Time Limit to 1000s. Lowering this value below 5 min can make the kill happen sooner, but raising it above 5 min does not prevent the kill at 5 min.

Is there some other timeout setting that governs this shutdown? Is it possible to go beyond 5 minutes?

The shutdown time limit hint leaves the old worker process running for up to the number of seconds indicated. If all requests are completed prior to that time, then it will shut down earlier. this is why you lower the value below 5 minutes to make the killing happen sooner.

And the maximum shutdown timelimit seconds appears to be 4294967, this is more than 5 minutes, But if there is not enough free memory, it will cause no more than 5 minutes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM