Taking an ASP.NET site down for maintenace

I woke up this morning to an Inbox full of exception notices from a client’s web application that was having some issues with a database server timing out and not properly responding to requests when it didn’t timeout. We needed to take the site offline immediately to notify users that the site was experiencing technical difficulties and that we were working to resolve the issue.

Some quick searching shed some light on a possible solution found on Scott Guthrie’s blog, which introduced me to the idea of using an App_Offline.htm file. This file, when present, will unload the application and cause all requests to be redirected to that file. I quickly created the App_Offline.htm file and was disappointed when IE was giving me a 404 error. Yes the site was now offline, but I needed to tell the users that we were aware of and working on the solution.

Digging a bit further led me to another post on Scott’s blog, as well as an article, which described the the 404 as being related to “IE Friendly Errors”. The solution was simple enough: ensure the App_Offline.htm is > 512bytes. I quickly added some CSS styling to my App_Offline.htm and Viola! the site was offline, informing users it would be back online shortly.

Once the database server was back @ 100%, I simply removed the App_Offline.htm file and the site was back Online!