Recently, I was looking for a way to present end-users of my web application with a friendly message and a correct http status 503 during intervals of upgrading a ASP.Net MVC web application.
Placing an app_offline.htm file in the application root folder looked like an ideal solution. This had one major drawback, however. I naively assumed that this page would be served for every request, no matter the state of the web application. It turns out, however, that this mechanism is built into ASP.Net and depends on a valid configuration of the web application. So, if for instance, a web.config file of the application is being modified and contains some error, the application will still return an error page, rather than just the app_offline.htm file contents.
Http redirection and the URL rewrite module both also depend on a valid web.config, so they cannot solved this issue.
Of course, we should avoid having an invalid web.config at all times, even during upgrade, but it has happened.