One of the benefits of using ASP.NET MVC is that during maintenance you are able to put your site to an offline state while making changes that could be interrupted or corrupted by users. In case of Orchard these are typically database I/O jobs. To prevent this, all you need to do is place a file named "App_Offline.htm" to the root directory (Orchard.Web) of your site and display any message to the users using HTML. While this file is present, user requests will not reach the Orchard site, instead handled by the server itself. To restore your site to online state, just rename "App_Offline.htm" to anything else.
In addition to this, we speed up this process by using a batch script that is called, for example "SwitchAppState.cmd" (it is placed in the same folder as "App_Offline.htm"):
if exist "App_Offline.htm" (
ren "App_Offline.htm" "App_Online.htm"
) else (
if exist "App_Online.htm" (
ren "App_Online.htm" "App_Offline.htm"
It sets site's state to the opposite by renaming "App_Offline.htm" to "App_Online.htm" or vice versa, so changing the state of your site is done by just a doubleclick.