Question

Based on my research, IIS 7.5 doesn't include the Connection:Keep-Alive in its response for reasons described here. Unfortunately, I have a non conforming client connecting to my web service that won't reuse sockets unless it sees Connection:Keep-Alive in the response header. I've tried programmatically adding this header but IIS appears to purposely strip it out. Is there any other way that I can force this header to be sent back to my naughty client?

Was it helpful?

Solution

I opened a support ticket with Microsoft on this and had my worst suspicions confirmed. IIS 7.5 deliberately prevents the connection:keep-alive header from being returned in the response. Per the HTTP 1.1 RFC, all connections should assume keep alive (a departure from HTTP 1.0). Therefore, the omission of this header is the default and correct (?) behavior. When keep-alives are not desirable, IIS will send the connection:close header.

What really surprised me is the great lengths to which IIS will go to to prevent this header from being sent. Something within the IIS pipeline strips out this header no matter how it is added. (C# code in my MVC application, IIS Manager-->HTTP Response Headers,IIS Manager-->URL Rewrite Module).

You would think MS would allow some sort of escape valve on this, given that there are so many non-conforming HTTP 1.1 clients in the wild that simply will not behave unless they see this header.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top