Share via


Customizing the File Types IIS Compresses

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

You can customize the file types IIS compresses. Enabling static file compression compresses .htm, .html, and .txt files. Enabling dynamic compression compresses .asp, .dll, and .exe files.

Important

You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /user:MyComputer</STRONG>Administrator cmd to open a command window with administrator rights and then type cscript.exe ScriptName (include the script's full path and any parameters).

Procedures

To add one or more file types to the server-wide static compression configuration

  1. From the Start menu, click Run.

  2. In the Open box, type cmd, and click OK.

  3. Type both of the following commands:

    • cscript adsutil.vbs SET W3SVC/Filters/Compression/Deflate/HcFileExtensions "htm" "html" "txt" "newext" where newext is a file type you want to compress (for example, Microsoft Word or Excel documents), then press ENTER. You can add multiple file types separated by spaces.

    • cscript adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcFileExtensions "htm" "html" "txt" "newext" where newext is a file type you want to compress, then press ENTER. You can add multiple file types separated by spaces.

Note

To remove one or more file types from the server-wide static compression configuration, repeat the previous two commands, leaving out the file type you want to remove.

To add one or more file types to the server-wide dynamic compression configuration

  1. From the Start menu, click Run.

  2. In the Open box, type cmd, and click OK.

  3. Type both of the following commands:

    • cscript adsutil.vbs SET W3SVC/Filters/Compression/Deflate/HcScriptFileExtensions "asp" "dll" "exe" "newext" where newext is a file type you want to compress (for example, aspx, a commonly used ASP extension), then press ENTER. You can add multiple file types separated by spaces.

    • cscript adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcScriptFileExtensions "asp" "dll" "exe" "newext" where newext is a file type you want to compress, then press ENTER. You can add multiple file types separated by spaces.

Note

To remove one or more file types from the server-wide dynamic compression configuration, repeat the previous two commands, leaving out the file type you want to remove.

For a detailed discussion of how HTTP compression works, how to test compression, and detailed compression configuration options, see Using HTTP Compression for Faster Downloads.

For more information about improving the performance of IIS network resources using related features like bandwidth throttling and connection timeouts, see Administering Network Resources.