How to Take an IIS Web Site Offline
(Microsoft .NET,Microsoft IIS,Microsoft ASP.NET)
by Jason Skowronek
on 10/27/2009
App_Offline.htm Static Override Page (prefered)
Adding a file in the application root named App_Offline.htm automatically causes the AppDomain to recycle and modifies its behavior such that any request for an ASP.NET resource returns the contents of the App_Offline.htm file instead (along with an HTTP 404 status). Deleting App_Offline.htm automatically recycles the AppDomain again and the web application is back to serving its usual content.*
- Create a static HTML page called App_Offline.htm
- Filesize must be at LEAST 512MB and cannot exceed 1MB in order to work properly as an offline mode trigger
Redirect the entire IIS Application (alternative)
- Create an offline or maintenance mode web page (per design specifications or use default version) and save the page to the application root directory
- Open IIS manager on the web server that is hosting the site/application
- Right-click the site/application name | Properties
- Click the "Home Directory" tab (or "Virtual Directory" tab if an application)
- Select "A redirect to a URL"
- Enter the fully qualified URL to the offline page
- Check "The exact URL entered above" checkbox
- Click Apply | OK