Custom app_offline.htm file during publish Custom app_offline.htm file during publish asp.net asp.net

Custom app_offline.htm file during publish


I know this is old but since I found a solution after looking here I thought I should provide an answer. VS 11 holds the publishing app_offline.htm file in this location:

C:\Users\[user]\AppData\Roaming\Microsoft\VisualStudio\11.0\app_offline.htm

I have tested this and customized it and it does work if you change this file. The down side, of course, is that this is the file used for all web publishing.


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.


I use my own

app_offline.htm_

file in the solution, which gets published. My deployment script then renames it (removing the trailing _) to make it active.

I can then run my db scripts/do whatever then rename the file bringing the site back.