IIS server on Microsoft Windows 2008 Servers returns error code 404 instead of 503 when the
virtual server turned off. The problem is how they designed HTTP.sys subsystem. There is
a workaround for changing this default behavior through URL reservation. (Windows server 2008 SP2 only)
Here are the steps to make it happen:
1) Open an administrative command prompt
2) Run the following command for each site, substituting the IP address in this
example for the IP address of your site, and the user as the app pool identity:
netsh http add urlacl url=http://172.30.137.57:80/ user=networkservice listen=yes delegate=yes
3) Stop and restart the HTTP services (NOTE: this will make your websites temporarily unavailable)
net stop http /y
net start w3svc
Screen capture for this configuration change can be seen here:
At this point, the IIS will respond with 503 error instead of 404 error when site turned off. You can see
that in the httperr.log file:
#Software: Microsoft HTTP API 2.0
#Version: 1.0
#Date: 2011-01-28 23:06:39
#Fields: date time c-ip c-port s-ip s-port cs-version cs-method cs-uri sc-status s-siteid s-reason s-queuename
2011-01-28 23:06:39 172.30.137.57 49812 172.30.137.57 80 HTTP/1.1 GET / 503 - N/A -
#Software: Microsoft HTTP API 2.0
#Version: 1.0
#Date: 2011-01-28 23:08:09
#Fields: date time c-ip c-port s-ip s-port cs-version cs-method cs-uri sc-status s-siteid s-reason s-queuename
2011-01-28 23:08:09 172.30.137.36 49816 172.30.137.36 80 HTTP/1.1 GET / 503 - N/A -
or from browser screen: