1

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.

driis
  • 207
  • 1
  • 4
  • 9

2 Answers2

1

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

Maximus Minimus
  • 8,987
  • 2
  • 23
  • 36
0

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

MikeM
  • 126
  • 3