KBA-01096: Enabling IIS6 Compression

Question:

I have remote users.  How do I enable IIS compression?

Answer:

Do the following on the IIS server:

  1. Backup the metabase:  This is done by right-clicking on the server in the IIS snap-in and selecting All Tasks > Backup/Restore Configuration.
  2. Compression Folder (optional):You can use the default folder (%windir%IIS Temporary Compressed Files) or create a folder of your choice.  Either way, the IUSR_{machinename} credentials will need write permission to the folder. Once running, it‘s worth double checking in the Event Viewer to see if any errors are occurring that keep IIS Compression from working.  Check this folder to verify that compressed static files are being cached.
  3. Enable Compression in IIS: From the IIS snap-in, right-click on the Web Sites node and click on Properties.  On the Service tab:
    1. Enable Compress application files
    2. Enable Compress static files
    3. Optional – review and/or change the Temporary Directory to the folder that you created above
    4. Set the max size of the temp folder to something that the hard drive can handle. i.e. 1000.
  4. Create a Web Service Extension (WSE):  From the IIS snap-in, select Web Service Extensions.  Create a new web service extension:
    1. Call it HTTP Compression
    2. Add the file c:windowssystem32inetsrvgzip.dll
    3. Check the Allowed checkbox
  5. Metabase changes:  Dynamic compression requires manual changes to the metabase:
    1. Use NotePad to open the metabase located at C:Windowssystem32inetsrvmetabase.xml
    2. Search for the IIsCompressionScheme tags – There should be two of them, one for deflate and one for gzip.
    3. Add file extensions to be compressed (see below)
    4. Set HcDynamicCompressionLevel to 8 or 9
  6. Restart IIS:  Either type IISRESET at the command prompt or return to the IIS snap-in, right click on the server name and restart IIS.

Additional Comments:

This extract from the IIS6 MetaBase.XML shows the file types.  Note that this extract is from the server‘s global compression settings.  You might use different settings if you wanted to tune different applications or folders specifically.

<IIsCompressionScheme Location =‘/LM/W3SVC/Filters/Compression/deflate‘
HcCompressionDll=‘%windir%system32inetsrvgzip.dll‘
HcCreateFlags=‘0‘
HcDoDynamicCompression=‘TRUE‘
HcDoOnDemandCompression=‘TRUE‘
HcDoStaticCompression=‘FALSE‘
HcDynamicCompressionLevel=‘9‘
  HcFileExtensions=‘htm
html
htc
js
css
txt‘
  HcOnDemandCompLevel=‘10‘
HcPriority=‘1‘
HcScriptFileExtensions=‘asp
aspx
asmx‘
 >
</IIsCompressionScheme>
<IIsCompressionScheme Location =‘/LM/W3SVC/Filters/Compression/gzip‘
HcCompressionDll=‘%windir%system32inetsrvgzip.dll‘
HcCreateFlags=‘1‘
HcDoDynamicCompression=‘TRUE‘
HcDoOnDemandCompression=‘TRUE‘
HcDoStaticCompression=‘TRUE‘
HcDynamicCompressionLevel=‘9‘
HcFileExtensions=‘htm
html
htc
js
css
txt‘
  HcOnDemandCompLevel=‘10‘
HcPriority=‘1‘
HcScriptFileExtensions=‘asp
aspx
asmx‘
 >
</IIsCompressionScheme>

Notes:

  • Dynamic compression greatly reduces outbound data at the expense of minimal server processing overhead.
  • When pages are compressed, the page cannot be rendered until the entire page arrives. In a purely intranet deployment, you might choose to run without compression.
  • Do not globally enable either dynamic or static compression of EXE or DLL files without also suppressing compression of the zero touch deployed software in the dashboard folder.
  • IIS5 does not provide native support for compression.  You would need third party software.  A better investment is to upgrade to IIS6.

References:

  1. Scott Forsyth‘s Weblog – http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx
  2. ZipEnable from Port80 Software –  http://www.port80software.com/products/zipenable/.

KBA-01096; Last updated: May 13, 2016 at 9:35 am;
Keywords:  remote