简体   繁体   English

无法在IIS中打开动态压缩

[英]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. 我在Server 2012(IIS 8.5)上有一个站点,但无法获得动态压缩以适用于aspx页面。 (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.) (我也无法使其在Server 2008R2上的IIS 7.5中正常工作,但是由于两者相似,因此我假设如果我让一个工作,另一个也可以。)

Requests are definitely called with Accept-Encoding: gzip, deflate. 绝对使用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. 在Web服务器级别,我同时启用了静态和动态压缩。
  • At the web server level, in the Configuration Editor, under httpCompression, I added the mime types I want. 在Web服务器级别上,在配置编辑器中的httpCompression下,添加了所需的mime类型。 I set the dynamic compression level to 4. This comes from http://weblogs.asp.net/owscott/iis-7-compression-good-bad-how-much . 我将动态压缩级别设置为4。这来自http://weblogs.asp.net/owscott/iis-7-compression-good-bad-how-much

The applicationHost.config has the compression section as follows: applicationHost.config的压缩部分如下:

       <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; 页面的实际mime类型是text / html; charset=iso-8859-1, but I expect text/* to cover it. charset = iso-8859-1,但是我希望text / *可以覆盖它。 I tried adding the mime type itself and it made no difference. 我尝试添加mime类型本身,但没有区别。

The trace logs show the DynamicCompressionModule starting and ending, but it is not doing any compression. 跟踪日志显示DynamicCompressionModule的开始和结束,但未进行任何压缩。 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. 我尝试快速重复页面请求,以防IIS 7.5上的GZip压缩中提到的应用2分10秒的限制不起作用 ,但这没什么区别。 I set the frequent hit threshold to 1 in the serverRuntime section of applicationHost.config. 我在applicationHost.config的serverRuntime部分中将频繁命中阈值设置为1。

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 我按照以下步骤设置了故障跟踪: 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. 我在2008R2服务器上尝试了所有等同于IIS 7.5的工作,但结果同样令人沮丧。

Try changing the below config to true 尝试将以下配置更改为true

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

Once you see compression works then give the proper mimeType that matches your response 一旦看到压缩效果,然后提供与您的响应相匹配的正确mimeType

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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