Partager via


HcDoStaticCompression Metabase Property

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

The HcDoStaticCompression property specifies whether responses to requests for static content, such as such as .htm and .txt files are compressed. Setting HcDoStaticCompression to true, indicates that static content is compressed when requested by a client. If static compression is enabled, each request for static content that contains the "Accept-Encoding: gzip" or "Accept-Encoding: deflate" header causes the content to be compressed, so long as the compression scheme specified in the header is enabled in IIS. If the request does not contain this header, or the header specifies a compression scheme that is not enabled in IIS, the content is not compressed.

If IIS determines that the response should be compressed, IIS checks the compression directory specified by the HcCompressionDirectory Metabase Property. If a fresh, compressed version of the static file is found in the directory, it is sent to the client browser. If a fresh, compressed version of the file is not found, and on-demand compression is enabled with HcDoOnDemandCompression Metabase Property, IIS sends the requested file in uncompressed form, and adds that file to the background compression queue.

At the individual compression scheme level (IIsCompressionScheme), the HcDoStaticCompression property determines which compression schemes IIS will support for static content: gzip, deflate, or both.

You can either enable compression of static content server-wide and then disable it at specific locations, or you can disable compression of static content server-wide and then enable it only at the locations you specify. To enable and disable static compression by using the HcDoStaticCompression property, do the following:

  • To enable static compression server-wide, set the HcDoStaticCompression property to true at the IIsCompressionSchemes level. You can then disable static file compression settings for an individual Web site or site element -- for example, a virtual directory or file -- by using the DoStaticCompression property at the individual site or site element level.

  • To disable static compression server-wide, set the HcDoStaticCompression property to false at the IIsCompressionSchemes level. You can then enable static file compression for an individual Web site or site element -- for example, a virtual directory or file -- by using the DoStaticCompression property at the individual site or site element level.

Important

If you change the value of the HcDoStaticCompression property at the IIsCompressionScheme level, the World Wide Web Publishing Service (WWW service) must be restarted before the change takes effect.

Attribute Name Attribute Value

XML Data Type

Boolean

WMI Data Type

Boolean

ADSI Data Type

Boolean

ABO Data Type

Boolean

ABO Metabase Identifier

MD_HC_DO_STATIC_COMPRESSION

Attributes

NO_ATTRIBUTES

Default Value

true

MetaFlagsEx

CACHE_PROPERTY_MODIFIED

User Type

IIS_MD_UT_SERVER

ID

2214

Configurable Locations

You can configure this property at the following locations in the IIS metabase.

Metabase Path IIS Admin Object Type

/LM/W3SVC/Filters/Compression/gzip /LM/W3SVC/Filters/Compression/deflate

IIsCompressionScheme

/LM/W3SVC/Filters/Compression/Parameters

IIsCompressionSchemes

Code Example

For general code examples, see Code Examples to Configure Metabase Properties.