【问题标题】:Unable to turn dynamic compression on in IIS无法在 IIS 中打开动态压缩
【发布时间】:2014-11-28 00:25:20
【问题描述】:

我已经阅读了几十个网站和 SO 问题,据我所知,它应该可以工作。我在 Server 2012 (IIS 8.5) 上有一个站点,无法获得动态压缩以适用于 aspx 页面。 (我也无法让它在 Server 2008R2 上的 IIS 7.5 中工作,但由于两者相似,我假设如果我让一个工作,另一个也会工作。)

请求肯定是用 Accept-Encoding 调用的:gzip、deflate。

到目前为止我有:

  • 安装了动态压缩。我可以在请求跟踪中看到正在调用的模块。
  • 在 Web 服务器级别,我启用了静态和动态压缩。
  • 在 Web 服务器级别,在配置编辑器的 httpCompression 下,我添加了我想要的 mime 类型。我将动态压缩级别设置为 4。这来自http://weblogs.asp.net/owscott/iis-7-compression-good-bad-how-much

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>

页面的实际 MIME 类型是 text/html; charset=iso-8859-1,但我希望 text/* 能够覆盖它。我尝试添加 mime 类型本身,它没有任何区别。

跟踪日志显示 DynamicCompressionModule 的开始和结束,但它没有进行任何压缩。我尝试快速重复页面请求,以防应用GZip Compression On IIS 7.5 is not working 中提到的 2 秒限制,但这没有区别。我在 applicationHost.config 的 serverRuntime 部分将频繁命中阈值设置为 1。

那么...接下来我可以尝试什么?我在此之后设置了故障跟踪: http://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis-85

我在 2008R2 服务器上尝试了所有这些工作的 IIS 7.5 等效项,结果同样令人沮丧。

【问题讨论】:

    标签: asp.net .net iis iis-7.5 iis-8.5


    【解决方案1】:

    尝试将以下配置更改为 true

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

    一旦你看到压缩工作,然后给出与你的响应相匹配的正确 mimeType

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-02
      • 1970-01-01
      • 1970-01-01
      • 2019-12-26
      • 2015-01-23
      • 2014-11-11
      • 2013-12-23
      相关资源
      最近更新 更多