BasicHttpBinding上的WCF压缩

时间:2012-11-20 18:37:19

标签: wcf compression gzip

尝试在WCF服务上启用压缩,但仍然没有成功,服务在basicHttpBinding上,因此它将内容类型返回为 text / xml; charset = utf-8 。 在我的applicationHost.config上添加了许多动态类型:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" doDiskSpaceLimiting="false" maxDiskSpaceUsage="100000" minFileSizeForComp="0" noCompressionForHttp10="false" noCompressionForProxies="false" noCompressionForRange="false" dynamicCompressionBufferLimit="6553600">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        <staticTypes>
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/atom+xml" enabled="true" />
            <add mimeType="application/xaml+xml" enabled="true" />
            <add mimeType="*/*" enabled="false" />
            <add mimeType="text/*" enabled="true" />
        </staticTypes>
        <dynamicTypes>
            <add mimeType="application/json" enabled="true" />
            <add mimeType="application/atom+xml" enabled="true" />
            <add mimeType="application/atom+xml;charset=utf-8" enabled="true" />
            <add mimeType="application/soap+xml" enabled="true" />
            <add mimeType="application/soap+xml; charset=utf-8" enabled="true" />
            <add mimeType="application/soap+xml; charset=ISO-8895-1" enabled="true" />
            <add mimeType="application/msbin1" enabled="true" />
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="Application/octet-stream" enabled="true" />
            <add mimeType="text/xml; charset=utf-8" enabled="true" />
            <add mimeType="application/xml; charset=utf-8" enabled="true" />
            <add mimeType="application/soap+msbin1" enabled="true" />
            <add mimeType="*/*" enabled="true" />
        </dynamicTypes>
    </httpCompression>

On Fiddler: 请求:

POST http://[omitted]/Service/ HTTP/1.1
Content-Type: text/xml; charset=utf-8
VsDebuggerCausalityData: uIDPo01MZ7JWHO9Kg43Hd3AGkiQAAAAASwm/c9G/206hW6j58tpV5waE+e97MShJvqGukMzMybEACQAA
SOAPAction: "http://tempuri.org/IService/GetCountries"
Host: [omitted]
Content-Length: 137
Expect: 100-continue
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive

响应:

HTTP/1.1 200 OK
Via: 1.1 PROXY
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 81623
Date: Tue, 20 Nov 2012 18:20:48 GMT
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET

我还能做什么?

0 个答案:

没有答案