因此,我有点像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" />
现在,我认为这意味着它应该压缩任何包含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 ***
"C:\Windows\System32\Inetsrv\Appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/javascript',enabled='True']" /commit:apphost
再说一遍:做出这些更改后-您只会在记事本中看到它们。Notepad ++(以及Visual Studio 2010编辑器!)