Bringing down an ASP.NET Application for updates

One of the really useful, and not well-known features of ASP.NET 2.0 is that you can use a special file to take your application down and show users a friendly message while you update the site.

This is talked about by ScottGu here.

What this will allow you to do is to make changes to this application while the rest of the site is functioning normally.  Users that try to use this application will get an error message that you put into the file.

So how do you accomplish this?  It is simple.  Just place a file called "app_offline.htm" in the root of your application.  The html of this file is what will get displayed to any users that attempt to browse to the site.  When you are done making changes, simply delete this file and the site will start back up normally.

This is a great solution if your application is being hosted by an ISP.  Because it is always better to update an application while it is stopped and this is a way for you to stop your application cleanly and update it without affecting any other applications running.

Scott's post talks about a size issue with IE6 that you should keep in mind if you use this file, you want to make sure the file is larger then 512 bytes.

There are some other best practices for production ASP.NET applications talked about here.

kick it on DotNetKicks.com