We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

App_offline.htm should return a Connection: close headerRSS

2 replies

Last post Nov 05, 2014 08:04 AM by jishimi

  • App_offline.htm should return a Connection: close header

    Jun 09, 2014 11:13 AM|jishimi|LINK

    Hi, I have been experimenting a bit with this feature and wanted to use this for loadbalancing purposes, but realized that it still uses keep-alive connections even though the response is a 503.

    I'm not sure if there is a reason behind this, but in the scenario where one is using a load-balancing proxy, such features might "stick" a visitor to a certain server until the keep-alive connection is killed, which would work against the principle of a failover cluster.

    In comparision, a web-site that has been shut down manually, will start returning a 404, with a connection: close header to efficiently kill the current persistent connection, and a retry would shuffle the visitor to another server.

    Some load-balancing systems do send a RESET packet to all active connections on a node, but this isn't necessarily an option.

    According to this dialog: https://issues.apache.org/bugzilla/show_bug.cgi?id=56555

    Both Tomcat and Apache httpd enforces a connection: close header for 503 responses. IIS even does this if it hits the connection limit configured.

    I tried adding it manually using rewrite rules, but to no avail.

    maintenance appoffline

  • Rovastar Rovastar

    5495 Posts



    Re: App_offline.htm should return a Connection: close header

    Jun 09, 2014 12:37 PM|Rovastar|LINK

    Not tested this or used the app_offline method for a downpage but where are the 503s being returned? IIS or the Http.sys?

    maintenance appoffline

    Troubleshoot IIS in style
  • Re: App_offline.htm should return a Connection: close header

    Nov 05, 2014 08:04 AM|jishimi|LINK

    Sorry for the late response, just found this thread when searching for this issue again.

    Seems like it is part of the ASP.NET pipeline. Weird because the application pool will be "off", but the functionality seems to be part of this method:


    Checking the decompiled source indicates that it throws a HttpException:

    throw new HttpException(503, string.Empty);

    Not sure what would be responsible for setting a Connection: Close, but with a 503 response, it seems logical that a connection: close should be desired (similar to how it's handled for a 404).

    maintenance appoffline