I am following Scott gu's trick of placing a App_Offline.htm page at the route of my application to bring it offline - http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx
It does not seem to be working on one of my sites though. I place the file in IIS7 of one my sites, and all traffic is redirected to it.
However in the other site, same server etc, I get a page that contains "The service is unavailable.".
Not sure where I am going wrong - any ideas?
I managed to solve it by putting the following code in my web.config:
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<clear />
<add value="index.html" />
<add value="app_offline.htm" />
</files>
</defaultDocument>
<httpErrors errorMode="Custom" existingResponse="Replace">
<clear />
<error statusCode="503" path="App_Offline.htm" responseMode="File" />
</httpErrors>
</system.webServer>
</configuration>
This fix was found by putting together some info from Scott Gu, npiaseck @ IIS Forum and Kurt Schindler.
this was my soluton - notice the 503...
<httpErrors existingResponse="Replace" errorMode="Custom">
<remove statusCode="404" subStatusCode='-1' />
<remove statusCode="400" subStatusCode='-1' />
<remove statusCode="500" subStatusCode='-1' />
<remove statusCode="503" subStatusCode='-1' />
<error statusCode="404" path="404.html" prefixLanguageFilePath="" responseMode="File" />
<error statusCode="400" path="404.html" prefixLanguageFilePath="" responseMode="File" />
<error statusCode="500" path="500.html" prefixLanguageFilePath="" responseMode="File" />
<error statusCode="503" path="app_offline.htm" responseMode="File" />
</httpErrors>
I had this issue with a MVC site recently, and I managed to solve it by replacing the web.config I originally had with a clean, minimal one when wanting to use the app_offline.htm file.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
If I had more time I'd go through and find the exact thing in the web.config that was altering the behaviour, but this is worth a shot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With