如何在 WPF 应用程序中压缩 WCF 3.5 响应和使用 WCF 服务



我想从WCF 3.5服务发送压缩数据作为响应&在WPF应用程序中访问该响应。我在IIS上托管了WCF应用程序;实现IIS压缩发送压缩响应到客户端。我通过引用以下链接

实现了iis压缩。http://www.hanselman.com/blog/EnablingDynamicCompressionGzipDeflateForWCFDataFeedsODataAndOtherCustomServicesInIIS7.aspx

当我访问MVC中的WCF服务时,压缩工作正常应用程序。但是当我尝试在WPF中访问相同的WCF服务时应用程序Fiddler显示服务响应未被压缩。

请帮我解决这个问题。

在MVC &WPF(Windows)应用程序在配置文件

中添加了以下绑定设置
<basicHttpBinding>
        <binding  name="EndPointHTTP" closeTimeout="00:59:00" openTimeout="00:59:00" receiveTimeout="00:59:00" sendTimeout="00:59:00"
                 allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                 messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                        maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
          </security>
        </binding>
      </basicHttpBinding>
<client>
      <endpoint address="http://ntvmsynrpt0389/SynergyLiteServicetInternet/SystemAdmin/SystemAdminService.svc"
          binding="basicHttpBinding" bindingConfiguration="EndPointHTTP"
          contract="ISystemAdmin" name="SystemAdminServiceEndpoint" behaviorConfiguration="CallContextEndpointBehavior">
      </endpoint>
 </client>  

我们在MVC中得到header作为
请求头

POST/SynergyAfricaServices SystemAdmin/SystemAdminService.svcHTTP/1.1内容类型:application/soap+xml;utf - 8字符集=主持人:ntvmsynrpt0389.fps.nihilent.com内容-长度:4132期望:

继续接受编码:gzip, deflate

响应头

HTTP/1.1 200 OK内容类型:application/soap+xml;utf - 8字符集=Content-Encoding: gzip变量:Accept-Encoding服务器:Microsoft-IIS/7.5X-Powered-By: ASP。NET日期:2013年6月5日星期三12:44:18 GMT内容长度:1179

对于WPF应用程序,我们得到的fidder输出为请求头

POST/SynergyLiteServicetInternet/共同/InfrastructureService.svcHTTP/1.1内容类型:text/xml;utf - 8字符集=VsDebuggerCausalityData:uIDPo93vMvxA6GNCkVCT0f7hH3cAAAAASYZ0KzDZuUqLJNzHwK2nZidcwKk9ROFEsMvZpKu5Rw0ACQAASOAPAction: "http://tempuri.org/IInfrastructure/LoadMenus"主机:ntvmsynrpt0389 Content-Length: 965 Expect: 100-continue

响应头

HTTP/1.1 200 OK Cache-Control: private Content-Length: 72001的content - type: text/xml;charset=utf-8服务器:Microsoft-IIS/7.5x - aspnet版本:4.0.30319NET日期:6月7日(星期五2013 06:14:51 GMT

第二组请求标头缺失Accept-Encoding: gzip, deflate。

最新更新