IIS App Pool is started with app_offline.htm in the app folder

iisiis-10windows-server-2016

I have Win Server 2016 with IIS, all updates applied as of this date. During updates to the sites running there, I put an app_offline.htm file in the app folder to bring the app pool down.

For a single specific app, putting the file there won't stop the application. I need to open task manager, kill it once, it then restarts (with the app_offline file there), the website remains opening as normal, then I close it the second time and then it will remain stopped for the update to occur.

This app is setup for a single worker, and no overlapped workers, that is, the new process will start only after the first one is finished. This specific app runs some code during shutdown that may take a few seconds to run, that could explain why it doesn't shutdown immediately, but doesn't explain why after killing the pool process, it will start again even with the file there.

Any ideas?

Best Answer

The problem was the default shutdown limit for the app, which is documented to be 10 seconds by default, but was obviously taking much longer. By explicitly setting the value in the web.config, the application shuts down after at most 10 seconds, which leaves me to investigate why the application is not shutting down before, but at lease the app_offline.htm works as expected with this change:

<system.webServer>
  <aspNetCore ... shutdownTimeLimit="10" />
</system.webServer>
Related Topic