在尝试实现gzip时,我很难找到有意义的文档。
我创建了一个新的wcf服务,其中包含一个返回整数列表以供测试的方法。
web.config看起来像这样
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<services>
<service name="TestWCF.TestService" behaviorConfiguration="defaultBehaviour">
<endpoint binding="customBinding" bindingConfiguration="cbCompression" contract="TestWCF.ITestService" />
</service>
</services>
<bindings>
<customBinding>
<binding name="cbCompression">
<binaryMessageEncoding compressionFormat="GZip"/>
<httpTransport />
</binding>
</customBinding>
<wsHttpBinding>
<binding name="cbCompression" >
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="defaultBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
我可以使用WCF测试客户端来调用服务,但期望看到压缩数据。相反,我看到一个整数列表。
因此我不知道gzip是否在响应中压缩我的数据,或者我是否错误地设置了配置。
帮助将不胜感激。其他堆栈问题没有涉及测试结果。