Maxing out HTTP compression in IIS7

Posted by & filed under code.

1:  In IIS7 manager, enable dynamic and static compriession.   (This adds <urlCompression doStaticCompression=”true” doDynamicCompression=”true” /> to applicationHost.config)

2: Open C:WindowsSystem32InetsrvConfigapplicationHost.config and go to the httpCompression section. For both dynamicTypes and staticTypes: <mimetype=”*/*” enabled=”true”>

3:   Run appcmd in %systemroot%system32inetsrv
appcmd set config /section:httpCompression /[name=’gzip’].dynamicsCompressionLevel:10
appcmd set config /section:httpCompression /[name=’gzip’].staticCompressionLevel:10

(Set the value to 7,8,or 9 for less CPU usage)

Note: compressing static files prevents them from displaying incrementally while the rest of the file downloads in the background. This may be useful for viewing partially loaded PDF’s, text files, images, etc. It may be appropriate to enable/disable compression per-directory in some cases.

More information on IIS7 HTTP compression.

Leave a Reply