简体   繁体   中英

Unable to turn dynamic compression on in IIS

I've read dozens of sites and SO questions, and as far as I can tell it should be working. I have a site on Server 2012 (IIS 8.5) and cannot get dynamic compression to work for aspx pages. (I can't get it to work in IIS 7.5 on Server 2008R2 either, but as both are similar, I assume that if I get one to work the other will also.)

Requests are definitely called with Accept-Encoding: gzip, deflate.

So far I have:

  • Installed dynamic compression. I can see the module being called in a request trace.
  • At the web server level, I enabled both static and dynamic compression.
  • At the web server level, in the Configuration Editor, under httpCompression, I added the mime types I want. I set the dynamic compression level to 4. This comes from http://weblogs.asp.net/owscott/iis-7-compression-good-bad-how-much .

The applicationHost.config has the compression section as follows:

       <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" doDiskSpaceLimiting="false" noCompressionForProxies="false" staticCompressionIgnoreHitFrequency="true" dynamicCompressionDisableCpuUsage="100" dynamicCompressionEnableCpuUsage="60">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4" />
        <dynamicTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" 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="application/atom+xml" enabled="true" />
            <add mimeType="application/xaml+xml" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </staticTypes>
    </httpCompression>

The actual mime type for a page is text/html; charset=iso-8859-1, but I expect text/* to cover it. I tried adding the mime type itself and it made no difference.

The trace logs show the DynamicCompressionModule starting and ending, but it is not doing any compression. I tried repeating the page request quickly, in case the 2-in-10-second limit applied as mentioned in GZip Compression On IIS 7.5 is not working , but that makes no difference. I set the frequent hit threshold to 1 in the serverRuntime section of applicationHost.config.

So... what can I try next? I set up failure tracing following this: http://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis-85

I tried the IIS 7.5 equivalents of all this work on a 2008R2 server with equally dismal results.

Try changing the below config to true

 <add mimeType="*/*" enabled="true" />

Once you see compression works then give the proper mimeType that matches your response

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM