如何启用 iis 7 动态内容压缩?

dav*_*dcl 5 iis compression iis-7 gzip

我在 IIS 7 中打开了动态内容压缩,但是 Fiddler 显示我的动态页面仍然在没有内容编码的情况下提供:gzip。

静态内容压缩在相同的服务器上运行良好。

不确定这是否重要,但大多数动态页面都是 Coldfusion 页面(Coldfusion 被配置为 ISAPI 扩展),我们也在使用 IIS URL 重写模块。

这是来自我的 applicationhost.config。

        <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
            <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>
...
        <urlCompression doDynamicCompression="true" />
Run Code Online (Sandbox Code Playgroud)

这是一个示例请求:

GET / HTTP/1.1
Host: web5.example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Run Code Online (Sandbox Code Playgroud)

和响应头:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/7.0
...
Date: Mon, 22 Feb 2010 20:59:36 GMT
Run Code Online (Sandbox Code Playgroud)

Viv*_*har 1

您可以按照此处提到的故障排除步骤进行操作。使用服务帐户在 IIS 6 和 IIS 7 中进行 HTTP 压缩