IIS 6: HTTP Compression Problem

Short Version

  • Error: Internet Explorer cannot display the webpage
  • Solution: Disable “HTTP Compression” in both Web extension and “Service” tab of Website properties

This short version is for those who are not interested about the details of this problem.

Long version

It took me almost 2 days to figure out about this issue so I’m going to share the details with you guys in this post. But as I didn’t use IIS 6 for long time and my main technical expertise is not IIS, the solution that I found might not be the best solution. If you guys know better solution for this issue, please feel free to share with us in comment section. Thanks!

Environment

Our server is Windows 2003 advanced server. We have .NET 1, .NET 2 and .NET 4 installed on that server. The existing website which is written in ASP.NET 2.0 is currently running on that server.

Problem

We got this issue when we tried deploying our new web application which is a hybrid app of ASP.NET 4.0 and ASP.NET MVC 3 on that server. To my surprise, ASP.NET MVC works great fine but ASP.NET 4.0 pages drove us crazy. I thought that the problem might come from the fact that our application is a hybrid so I created a brand new ASP.NET 4.0 application in Visual Studio 2010 and published it on the server but it didn’t work. It’s very weird because MVC project is working fine so .NET 4 framework shouldn’t have any problem but couldn’t figure out why ASP.NET 4.0 site wasn’t working.

In order to narrow down the problem, I created new Virtual Directory and new application pool and put a HTML page in that directory so we don’t need to worry about .NET issue. but this issue was getting more weird. Can you guess what happened? When I tried accessing that page from browser, it was working fine for the first time request but it didn’t work for second time request. I got different errors as below in different browsers.

IE

Internet Explorer cannot display the webpage

Google Chrome

This web page is not available The web page at http://19x.10x.10x.2:17x/simpleweb/c.html might be temporarily down or it may have moved permanently to a new web address. Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.

Firefox

Content Encoding Error The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression. Please contact the website owners to inform them of this problem.

IE didn’t give any information as usual (well, we love IE! :P ) but when I saw the error message in Firefox, the encoding and gzip things came into my mind but I wasn’t so sure whether IIS server stopped responding the second request or the encoding issue. I looked at IIS log. As you can see below, IIS returns 200 so IIS wasn’t blocking the second request.

IIS log

#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2011-12-14 06:27:57
#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status sc-bytes cs-bytes

2011-12-14 06:29:27 W3SVC1531730165 127.0.0.1 GET /simpleweb/d.html – 170 – 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET4.0C;+.NET4.0E) – 200 0 0 378 284

Just to make it more sure, I used Fiddler to capture the traffic between the browser and server. I managed to get the response but when I viewed the response stream, I got this error below in Fiddler.

—————————
Fiddler: UnGZip failed
—————————
The content could not be decompressed.
The magic number in GZip header is not correct. Make sure you are passing in a GZip stream.
—————————
OK
—————————

Solution

As Fiddler showed that there is something wrong with gzip, I decided to turn off the HTTP compression on that server.

How to turn off the HTTP compression on IIS 6? It’s pretty simple. Go to the properties of Website (not virtual directory or application) and uncheck “Compress application files” and “Compress static files” on “Service” tab. And set “Prohibit” to “HTTP Compression” in Web extension.

Note that I tested HTTP compression on fresh 2003 server and it works so I think gzip assembly got some problems on that server only. That’s why I mentioned that disabling HTTP compression might not be the best solution but we decided to stop experimenting it for now because we are using 2003 server temporarily. I don’t think it’s good idea to host ASP.NET 4 app and MVP app on IIS 6 so we are going to get new Windows 2008 R2 service with IIS 7 later.. But yeah. if you have a better solution then please share with us.

Credits: Thank you all to everyone who gave a lot of suggestions for this issue. You guys helped me a lot. Thanks! 

One thought on “IIS 6: HTTP Compression Problem

Leave a Reply

Your email address will not be published. Required fields are marked *