为什么 IIS 7 忽略某些(但不是全部)MIME 类型进行压缩?给出错误:DYNAMIC_COMPRESSION_NOT_SUCCESS - 原因 12

Pet*_*ert 11 compression iis-7 configuration

所以,我有点像 IIS7 n00b,但我已经使用了大部分旧的 IIS 系统,可以追溯到 3。我正在尝试打开动态压缩,并且它正在工作,主要是。它不适用于我的 ADO.Net 数据服务 (Astoria) 请求,无论是否批处理。

我发现失败的请求 (FREB) 跟踪非常有用。我在非批处理请求中看到的是Reason Code 12, NO_MATCHING_CONTENT_TYPE. 好的,所以我没有指定匹配的 MIME 类型,这很简单。

除了这是我在 web.config 中的内容(我认为这是正确的,但也许不是)。

<httpCompression dynamicCompressionDisableCpuUsage="100"
                 dynamicCompressionEnableCpuUsage="100"
                 noCompressionForHttp10="false"
                 noCompressionForProxies="false"
                 noCompressionForRange="false"
                 sendCacheHeaders="true"
                 staticCompressionDisableCpuUsage="100"
                 staticCompressionEnableCpuUsage="100">
    <dynamicTypes>
        <clear/>
        <add mimeType="*/*"
             enabled="true" />
    </dynamicTypes>
    <staticTypes>
        <clear/>
        <add mimeType="*/*"
             enabled="true" />
    </staticTypes>
</httpCompression>
<urlCompression doDynamicCompression="true"
                doStaticCompression="true"
                dynamicCompressionBeforeCache="false" />
Run Code Online (Sandbox Code Playgroud)

现在我认为这意味着它应该压缩任何包含 Accept:Gzip 标头的请求。我很想知道其他人在这里会怎么想。

我的小提琴手踪迹:

GET /SecurityDataService.svc/GetCurrentAccount HTTP/1.1
Accept-Charset: UTF-8
Accept-Language: en-us
dataserviceversion: 1.0;Silverlight
Accept: application/atom+xml,application/xml
maxdataserviceversion: 1.0;Silverlight
Referer: http://sdev03/apptestpage.aspx
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Host: sdev03
Connection: Keep-Alive
Cookie: .ASPXAUTH=<snip>


HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Type: application/atom+xml;charset=utf-8
Server: Microsoft-IIS/7.0
DataServiceVersion: 1.0;
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 22 Mar 2010 22:29:06 GMT
Content-Length: 2726

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
*** <snip> removed ***
Run Code Online (Sandbox Code Playgroud)

Pet*_*ert 7

好的,结果你不能在 web.config 中配置它,只能在 appHost.config 中配置。我认为文档确实说 appHost.config 但我认为它是一般概念的规范,而不是唯一允许的配置位置。