GZip compression in IIS7 does not work, but the content encoding header is set to gzip

I have IIS 7.5 with static and dynamic compression enabled. It seems to work fine for dynamic files, but for static it behaves erratically, often sending the http "Content-Encoding: gzip" header when the content is not compressed. This leads to the fact that browsers try to unpack, giving the wrong magic number error. Here is my configuration:

  <httpCompression dynamicCompressionDisableCpuUsage="95" dynamicCompressionEnableCpuUsage="70" >
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
  <dynamicTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="application/json" 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="application/x-javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
  </staticTypes>

 

I thought some kind of http module was pushing the content somewhere along the pipe, but none of them seemed suspicious. Any ideas?

+5
source share
3 answers

, .

    <urlCompression dynamicCompressionBeforeCache="true" doDynamicCompression="true" doStaticCompression="true" />
+2

, HttpContext.RewritePath() .

+2

, . hourHitThreshold 1 system.webServer/serverRuntime node applicationHost.config , http://www.iis.net/ConfigReference/system.webServer/serverRuntime.

, :

%windir%\system32\inetsrv\appcmd set config /section:serverRuntime /frequentHitThreshold:1 /commit:apphost

- " " . , !

0

All Articles