Gzip http compression problem on iis7

2019-07-20 04:32发布

问题:

My web hosting provider is running IIS7 and I am having loads of trouble to get gzip compression to work properly. Host admins say compression is installed. I can confirm compression using some online checking services but not with others. PageSpeed Firefox add-on also says the site is uncompressed. I am personally sitting behind a Squid proxy but web.config settings should take care of proxy issue. Below is the relevant web.config snippet. Most of it is borrowed from various sites. Any thoughts?

    <urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" doStaticCompression="true" />
    <httpCompression cacheControlHeader="max-age=86400" noCompressionForHttp10="False" noCompressionForProxies="False" sendCacheHeaders="True" dynamicCompressionEnableCpuUsage="89" dynamicCompressionDisableCpuUsage="90" minFileSizeForComp="1" noCompressionForRange="False">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
    </httpCompression>

回答1:

This post is about 4 months old, but have you checked if dynamic compression is enabled in IIS? There's an article here on how to do it http://blog.wassupy.com/2009/08/enabling-dynamic-http-compression-in.html

By default IIS it isn't enabled. Might be worth trying.



回答2:

Try two this towards resolving this issue:

  1. Try following the case standard for setting booleans in the web.config and use lower case rather than pascal casing.

  2. Try connecting to the site on the server via IIS if your host allows this and check the compression section to see if it is locked.