tags:

views:

32

answers:

1

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?

A: 

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

matt-dot-net
I'm using the http handler to send back images that will be displayed inline in the page. Sending it back as an attachment won't work. Content-type, at the moment, is image/png, but really it could be image/jpeg or image/gif too.
Chris
Yeah, ok - then there's absolutely nothing wrong with your code.
matt-dot-net