How to add content types for HTTP compression in IIS 7.0
This article describes how to add more content types for HTTP compression in Internet Information Services (IIS) 7.0.
Beginning in IIS 7.0, the HTTP compression is configured by specifying the MIME types that are to be compressed. This differs from earlier versions of IIS, in which compression is configured by specifying the file name extensions to be compressed. The ability to add, to modify, or to delete MIME types from the static and dynamic HTTP compression scheme is not exposed through the default IIS 7.0 user interface. To make these changes, you must use the Appcmd.exe command-line tool.
The following code examples show some of the Appcmd.exe syntax that you can use to add additional MIME types to the HTTP compression settings in IIS 7.0.
- To add the "text/xml" MIME type to the static compression configuration for the whole web server, use the following command:
appcmd set config /section:httpCompression /+staticTypes.[mimeType='text/xml',enabled='true'] /commit:apphost
- To add the "application/octet-stream" MIME type to the dynamic compression configuration for the whole web server, use the following command:
appcmd set config /section:httpCompression /+dynamicTypes.[mimeType='application/octet-stream',enabled='true'] /commit:apphost
- You can also add wildcard entries for the MIME types. However, you can set MIME types for the web server level only. For example, to enable static compression for all MIME types for the default website, first add wildcard entries for the MIME types for the server level, and then enable static compression for the default website. To do this, run the following command:
appcmd set config /section:httpCompression /staticTypes.[mimeType='*/*'].enabled:"true" /commit:apphostappcmd set config “Default Web Site” /section:urlCompression /doStaticCompression:”True”
For more information about the changes that were made to compression in IIS 7.0, visit the following IIS website:
http://technet2.microsoft.com/WindowsServer2008/en/library/30e64245-ec6b-4c4e-891b-b7249e36c0a01033.mspxFor more information about the Appcmd.exe tool in IIS 7.0, visit the following Microsoft TechNet website:
Article ID: 969062 - Last Review: 09/21/2010 18:55:00 - Revision: 2.0
Microsoft Internet Information Services 7.0
- kbexpertiseinter kbhowto kbsurveynew KB969062