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?

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.htmis in effect.The actual file system event information takes just a few milliseconds to propagate.