Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

app_offline site returning "The service is unavailable."

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?

like image 880
amateur Avatar asked Jun 16 '13 15:06

amateur


3 Answers

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.

like image 54
demoncodemonkey Avatar answered Nov 17 '22 03:11

demoncodemonkey


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>
like image 12
JGilmartin Avatar answered Nov 17 '22 03:11

JGilmartin


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.

like image 2
Henry C Avatar answered Nov 17 '22 05:11

Henry C