简体   繁体   English

如何压缩来自WCF服务的响应?

[英]How to compress responses from wcf service?

I have correctly setup dynamic compression on IIS7, and using fiddler I can see the reduction on content-length when compression is enabled. 我已经在IIS7上正确设置了动态压缩,使用fiddler可以看到启用压缩后内容长度的减少。 ie message size was 22882677 - then compressed to 1493531 也就是说,邮件大小为22882677-然后压缩为1493531

using basichttpBinding with maxReceivedMessageSize = 20971520 . 使用basichttpBinding和maxReceivedMessageSize = 20971520

yet, my application still throws an error, saying the max size (20971520) has been exceeded. 但是,我的应用程序仍然引发错误,并说已超出最大大小(20971520)。

my question is, when does the response get decompressed? 我的问题是,响应何时解压缩? am I missing something here? 我在这里想念什么吗?

Can you use a custom binding (binary)? 您可以使用自定义绑定(二进制)吗? (Adjust reader quotas to your liking) (根据您的喜好调整读者配额)

<customBinding>
  <binding name="MyHttpBinding">
    <binaryMessageEncoding>
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
    </binaryMessageEncoding>
    <httpTransport />
  </binding>
</customBinding>

Or NetTCPBinding? 还是NetTCPBinding?

This will compress the response. 这将压缩响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM