When I publish my ASP.NET MVC application it generates a app_offline.htm file to take the site offline while it updates the website and then deletes the file once the publis
An easy solution that many might find suitable involves simply adding your own file also named "app_offline.htm"
to your solution.
I have tested this method, using Visual Studio 2015, and it does indeed work.
However, the only drawback is that during the publishing process, the default generated app_offline.htm
file is copied first, then the solution files in what appears to be in/near alphabetical order.
This means that your custom app_offline.htm
file quickly (but not instantly) overwrites the system generated file. Therefore the (ugly) system generated copy of app_offline.htm
might be served to requests within a 1-2 second window of initiating the publish, before being updated with your custom file.
The publishing process automatically deletes the app_offline.htm
from the remote server irrespective of its content or origin.
The advantage is (over replacing the system copy) is that your own copy is portable, is automatically solution-specific, and works with source control.
I know this question is old, but I hope this helps others coping with this issue.