How long does it take for IIS to shut down after app_offline.htm is in place?

1.2k Views Asked by At

I have a deployment workflow for an ASP.NET web app which begins with puttin an app_offline.htm file to the directory of my web app. Despite that, I usually get this error:

The process cannot access the file ... because it is being used by another process.

Indicating that the IIS process is still running despite the fact that the app_offline.htm file is in place. If I remote desktop to the server and do a manual iisreset or shut down IIS with its GUI (or just wait a few minutes after manually putting the app_offline.htm file there, then the workflow works correctly.

So, how long does it take for IIS to shut down after app_offline.htm is in place?

2

There are 2 best solutions below

1
On

The default is (up to) 90 seconds. This is defined in the application pool settings that your web application is running under in IIS as "Shutdown Time Limit".

Process Model documentation at Microsoft enter image description here

6
On

I don't know but I would like to know. So I ran some tests...

The effect is pretty much immediate, but it may take some time for the IIS app to actually shut down due to extra clean up code. Expect files to be locked for some time even after app_offline.htm is in effect.

The actual file system event information takes just a few milliseconds to propagate.

procmon