0
votes

I'm experiencing the issue documented here:

http://support.microsoft.com/kb/914453

You access Web applications or Web sites from a Web server that uses chunked transfer encoding on a Microsoft Windows Server 2003-based or on a Microsoft Windows XP-based computer. Then, the browser or the Web applications stop responding.

This problem occurs when the Wininet.dll file receives an incomplete chunk of data during the initial Winsock data receive operation. When this behavior occurs, the second Winsock data receive operation reads only a chunk token. For example, the second Winsock data receive operation may only read carriage-return line-feed (CRLF) from the socket. Then, the Wininet.dll file makes continuous calls to the Winsock Select function for 30 seconds. The file is waiting to receive more data. However, if no data arrives, the browser or the Web application stops responding.

The issue is occurring with an HttpHandler I have implemented to retrieve files from the database. The relevant code is:

var buffer = GetSomeByteArray();
context.Response.Clear();
context.Response.ContentType = type;
context.Response.BinaryWrite(buffer);                        
context.Response.End();

I can disable chunked encoding at the IIS 6 level by turning off dynamic compression or simply not specifying .axd as a compressible file type, but I'd prefer not to do that. My question is, is there a bug in my code or something I'm not doing that I should be that would prevent the browser from receiving an incomplete chunk?

1
I don't do ASP/IIS, but in case of JSP/Servlet, chunked encoding will only be used when you don't set the content length header before emitting the response. If you set the content length header, then just streaming mode will be used. See if it helps for your ASP/IIS app to set the content length beforehand.BalusC
IIS will force chunked encoding when it has to compress 'dynamic' content because it doesn't cache it so the compression happens on the fly. This issue here is not compression - that's just what triggers the chunked encoding in the first place. In fact, I actually had a line in my code to add a Content-length header but IIS will not send a Content-length header when it uses chunked encoding because that would violate the spec.Chris

1 Answers

0
votes

Your code is good. How big are these files? What about using content-disposition: attachment? Also, what Content-Type?