App_Offline.htm, taking site down for maintenance
- by Vipin
There is much simpler and graceful way to shut down a site while doing upgrade to avoid the problem of people accessing site in the middle of a content update.
Basically, if you place file with name 'app_offline.htm' with below contents in the root of a web application directory, ASP.NET will shut-down the application, and stop processing any new incoming requests for that application.
ASP.NET will also then respond to all requests for dynamic pages in the application by sending back the content of the app_offline.htm file (for example: you might want to have a “site under construction” or “down for maintenance” message).
Then after upgrade, just rename/delete app_offline.htm file…and the site would be back to normal.
Just remember that the size of the file should be greater than 512 bytes, doesn't matter even if you add some comments to it to push the byte size as long as it's of the size greater than 512 - it'll work fine.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html http://www.w3.org/1999/xhtml"http://www.w3.org/1999/xhtml" ><head> <title>Maintenance Mode - Outage Message</title></head><body> <h1>Maintenance Mode</h1>
<p>We're currently undergoing scheduled maintenance. We will come back very shortly.</p> <p>Sorry for the inconvenience!</p>
<!-- Adding additional hidden content so that IE Friendly Errors don't prevent this message from displaying (note: it will show a "friendly" 404 error if the content isn't of a certain size). <h2>Site under maintenance...</h2> <h2>Site under maintenance...</h2> <h2>Site under maintenance...</h2> <h2>Site under maintenance...</h2> <h2>Site under maintenance...</h2> <h2>Site under maintenance...</h2> <h2>Site under maintenance...</h2> <h2>Site under maintenance...</h2> --></body></html>