Friday, January 20, 2012

App_Offline.htm

One of the little known features in ASP.NET is the "App_Offline.htm" feature. It  provides a super convenient way to bring down an ASP.NET application while you make changes to it.

appoffline

To make this feature work, you have to place the app_offline.htm file in the root of the application. When ASP.NET sees it, it will shut-down the app-domain for the application (and not restart it for requests) and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application.

Once you remove the app_offline.htm file, the next request into the application will cause ASP.NET to load the application and app-domain again, and life will continue along as normal.

One remark: there are some gotcha’s when using this in ASP.NET MVC context. More information about this here: http://blog.kurtschindler.net/post/app_offlinehtm-gotchas-with-aspnet-mvc

No comments: