In quite some scenario's, placing app_offline.htm
in the root is just right: you do some updates, the message appears while updating, and that's that. The idea is, as Microsoft puts it, that before anything is called, IIS first checks if app_offline.htm is there and if so, it cancels everything and displays it.
So for so good, but in many situations it doesn't work:
- When you have a compile error in an ASPX page and a user links directly to it
- When you have conflicting assemblies
- When you have a parsing error in your web.config
- In the midst of removing / uploading the entire site.
- A direct link to a static HTML page is still displayed as such
- File-not-founds, access-denieds are thrown before the message is shown
Possibly more scenario's exist that fail. My point is: for any serious updating work, app_offline.htm is not suitable. I sometimes create a redirect in IIS, to another site, but another site may not always be available and it can confuse users.
Ideally, I'd want to keep the current location in the url location bar of the end-user, show the message, and have the page auto-refresh each minute to see whether the site is back, so that the user continues where he left of when the site comes back. While technically easy enough with a static page, it will fail for the above mentioned reasons the minute an error is thrown.