I had a nice little Sunday planned today, but it was interrupted by the SharePoint911 uptime monitors telling me that our web server had pooped itself (technical term… trust me). Shane did some poking around and found that the hard drive had died… we have backups but bringing it back online is going to take a bit (our clients always come first!). We decided to temporarily put up a maintenance page until we can bring the site back completely. I had to do some GoogleBing’ing to find a simple way to funnel all of the web links that point to our various pages and blogs to one page telling people we are working on the problem.
Turns out the solution is actually pretty simple. Any ASP.NET 2 app (including SharePoint) can funnel all web traffic to one HTML page just by placing a file named app_offline.htm
into the IIS web root. Here is more information on the technique:
Taking an ASP.NET 2.0 Application Offline
I did run into two gotcha’s:
- Make sure the file is over 512 bytes – Not sure why, but IIS thinks the file couldn’t possibly convey any useful information if its under that size and doesn’t use it.
- Loading images on the page can be challenging, they need to come from another web app or server or you need to do a lot of extra work to encode them. I didn’t bother with this method but you can search for it on the web if you want… I just hosted the images from our public Dropbox folder.
AWS S3 is a great place to stage images, too.
Hello Randy,
This trick comes in handy. Thank you very much.
-hn
I have also seen that Newsgator is using the same technique for Central Admin to show you a page telling you that Newsgator is being installed. In our case the installation went wrong and although everything was deinstalled, the message remained. It took a while before I realized that this page was sitting there in the web folder. 🙂
Great tip, Randy.
tk
Thanks for sharing valuable information regarding ASP.NET 2.0 applications. Keep up the good job.
As an unsolicited FYI, I believe the app_offline.htm size threshold is an IE thing (as opposed to IIS). They’ve always seemed to serve just fine to FF, Safari, and Chrome (for custom apps and SharePoint).
Great tip!