I had the same problem recently when adding a app_offline.htm
page to one of my sites.
All the answers here suggest to set the 503 response to the same app_offline.htm
, I already have a different 503 page and don't really want to fiddle with that.
Also, I liked to know why this is happening.
The 503
is sent by the AspNetInitializationExceptionModule, I assume if the asp.net runtime detects the app_offline.htm
file in the root of the web site, it sends an
503 Service Unavailable
and also does send the content of the app_offline.htm
as a response.
However, because it is an error response the IIS error handing kicks in:
<httpErrors existingResponse="Replace">
The Replace
here means, ignore whatever ASP.NET sent you and use your own 503 response. By specifying the same page (app_offline.htm
) like suggested in the other answers this fixes the problem.
Another way to fix this is to change the existingResponse attribute, like:
<httpErrors existingResponse="Auto">
now IIS honours the response from ASP.NET and shows the content of the app_offline.htm
file.
But Auto
also means that other ASP.NET error responses may pass through.