Custom app_offline.htm file during publish

Custom app_offline.htm file during publish

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 publish is successful.

This is cool and I really like the idea, but I want to create my own custom app_offline.htm file that the publish action is aware of and put it somewhere where it doesn't effect my development site - i.e. it doesn't sit in the root of my development site rendering it offline all the time.

EDIT: From the comments on Scott Gu's post about app_offline.htm, it seems that customization of the app_offline.htm file wasn't possible with VS 2005 - has this changed with VS 2008 and now VS 2010?

ASP.NET MVC Error: Page is not allowed here because it does not extend class 'System.Web.Page'


Extension method not working if I set controller property in Action, works in OnExecuting
I know this is old although since I found a quick fix after looking here I thought I should provide an answer. Using external javascript files with MVCVS 11 holds the publishing app_offline.htm file in this location:. how to give image path in java script in mvc
I have tested this and customized it and it does job if you change this file. User.Identity.Name returning NT AUTHORITY\NETWORK SERVICE i want Domain\USERThe down side, of course, is this this is the file used for all web publishing.. ASP.NET MVC download image rather than display in browser
Why does this render as a list of “System.Web.Mvc.SelectListItem”s?Can I use the <%: tag on an application that will be hosted on IIS6?


I use my own .
file in the solution, which receive s published. My deployment script then renames it (removing the trailing _) to make it active.. I must then run my db scripts/did whatever then rename the file bringing the site back..


Andrew bullocks answer works like a charm! although it depends on which visual studio you are using..
is the directory you should first land at, choose your VS version[ 8.0/9.0.....] and edit the app_offile.htm file..


You must use a batch file which calls the compiler with the current directory information as parameters... It then copies app_offline.htm and copies the new file over. Run it from where the source is.. I personally use a program which is just a bit more elaborate then the batch and also checks hash's of files to determine if they need updating makes a zip of new files and extracts it to the remote host and eliminates files i designate are for unit testing when going from test to production. I have also combined SVN integration into my quick fix so when you publish for test or production you also optionally commit to SVN. The program is stored on a netjob drive and is called from a batch file on the local PC with the current directory info. This way dev's dont have to update to the new deployer or the app_offline if any changes occur. Finally it removes the app_offline.. Check out for more info or if you are just making a quick batch!. Additionally in the post you initially referenced and I have also verified you must actually change it although you change it for others using the publish feature as well. This is why you were given the answer you were..


An easy quick fix this 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 this during the publishing process, the default generated app_offline.htm file is copied first, then the quick fix files in what appears to be in/near alphabetical order.. This means this your custom app_offline.htm file quickly (although 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 this your own copy is portable, is automatically solution-specific, and works with source control.. I know this question is old, although I hope this helps others coping with this issue..


For users of Visual Studio Express 2013 for the Web, the file is located at C:\Users[user]\AppData\Roaming\Microsoft\VWDExpress\12.0 . That one must be modified to your needs..


Back in 2006, Scott Gu said this there was no way to customize the file which VS generates on Publish. . Comment within original article. I'd be interested in solving this too, although I was unable to turn up anything definitive to the contrary on Google..


Have you seen this?. App_Offline.htm . It might not be (exactly) what you want although it does solve the issue I think..

79 out of 100 based on 64 user ratings 539 reviews