Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I configure IIS to automatically serve static resources (pictures, javascript, css and so on) compressed for clients that support it - and serve "normal" content for clients that does not support compression ?

Also, can IIS6 cache the compressed version of the resources for me, so that I don't need to burn CPU cycles for doing the compression, on each request ?

I need to enable this for a specific folder on the website.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

It's probably not gzip, but here's the lowdown on HTTP compression in IIS 6: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d52ff289-94d3-4085-bc4e-24eb4f312e0e.mspx?mfr=true

share|improve this answer

Here's the command line options to set it all up:

ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE

ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoDynamicCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcFileExtensions "asx" "css" "doc" "htm" "html" "js" "txt" "xml"
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcScriptFileExtensions "asp" "ashx" "asmx" "aspx" "axd" "dll" "exe" "svc"
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcOnDemandCompLevel 10
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDynamicCompressionLevel 9

ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoDynamicCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcFileExtensions "asx" "css" "doc" "htm" "html" "js" "txt" "xml"
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcScriptFileExtensions "asp" "ashx" "asmx" "aspx" "axd" "dll" "exe" "svc"
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcOnDemandCompLevel 10
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDynamicCompressionLevel 9

IIS Reset, clear your cache, open Fiddler, open IE, make a request and voila, compressed content! One thing to note that on the dynamic level compression happens with each request. The blogosphere statea that the trade-off between levels 9 and 10 for dynamic compression is such that you will want to consider 9 because it takes exponentially less CPU versus the benefit.


Here's the most concise method of getting compression working on IIS 6 that I've found, the above was taken from a comment by Colin Bowern on http://www.codinghorror.com/blog/2004/08/http-compression-and-iis-6-0.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.