Enabling gzip compression in IIS and having it take effect

We've enabled Gzip compression on the server in IIS (IIS6). We've run iisreset. It just doesn't want to take effect. We had this before on another server, and after a little while, it just started working.

Is it supposed to "take" right away? If not, how long does it take? Is there anything that we can do to expedite this?


Are you sure the result's not being cached? You can verify the server remotely here


Also, by default IIS 6.0 is only configured to compress the following file types: htm, html, txt, asp, dll, exe.

So if you're browsing to some other type of file (php or aspx, for example) it won't be compressed.

You can configure additional file types to be compressed using the following commands:

for static file types...

cscript c:\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/Filters/Compression/deflate/HcFileExtensions htm html txt css js  
cscript c:\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcFileExtensions htm html txt css js

for dynamic file types...

cscript c:\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/Filters/Compression/deflate/HcScriptFileExtensions asp dll exe aspx asmx php
cscript c:\Inetpub\AdminScripts\adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcScriptFileExtensions asp dll exe aspx asmx php

Here's a list of everything necessary to get IIS 6 compression enabled: http://weblogs.asp.net/owscott/archive/2004/01/12/IIS-Compression-in-IIS6.0.aspx. Double check that to ensure that you set everything.

As long as you configured it correctly and did an iisreset and nothing is cached, it will take affect immediately.


An additional note: for static files, IIS doesn't do any compression on the first request. It serves the first request for say "myfile.html" uncompressed, and then compresses the static file in the background, and sticks it in the compressed files cache. All subsequent requests for "myfile.html" will then return the compressed version.

This is a somewhat unnecessary optimization in my opinion, but I think the idea is to not make the first requester wait for compression to happen, since IIS uses very aggressive and CPU-intensive compression settings for static content by default (similar to gzip -9). All subsequent requests for the file use the highly-compressed version from cache.

The opposite is true for dynamic pages on IIS... it uses a very low compression setting by default (similar to gzip -1), and compresses every page on-the-fly.