IIS7 content-length ignored

Had some issues yesterday whilst testing a web application we were upgrading to .NET 4.0 and IIS 7.0.  The solution stores files in a database then writes then out to file using a Response.BinaryWrite and setting the content-length so the output is truncated at the correct length.

The solution worked perfectly under Visual Studio but as soon as we deployed to IIS 7.0 the entire response stream would be written to file and the content-length was being ignored.  We tracked the issue down to IIS 7.0 having dynamic compression turned on by default.  To fix the issue go to the IIS admin console, select the application and look for the compression icon in the features view, then disable dynamic compression.  That fixes the issue until the code can be revisted.

Advertisements
This entry was posted in .NET. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s