我可以在 WCF 中使用 net.TCP 和 GZip 技术吗
我们可以使用 net.TCP 绑定在 WCF 中实现 GZip 还是只能使用 Http 和 WsHttp 绑定进行配置。
Can we use net.TCP binding to implement GZip in WCF or it can only be configured with Http and WsHttp bindings.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不相信 WCF 支持使用 TCP 套接字绑定的 GZip 编码,但是没有什么可以阻止您通过网络发送 GZiped 压缩数据,并使用 .NET 框架内置的方法手动压缩它: http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx。
然而,在您走这条路线之前,我强烈建议您评估 TCP 服务的其他性能增强措施,如下所示:使用 WCF 通过线路传输最少的数据
I don't believe WCF supports GZip encoding using a TCP socket binding, however there is nothing stopping you sending GZiped compressed data over the wire, and manually compressing it using the methods built into the .NET framework: http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx.
Before you go down this route however, I would strongly recommend assesing other performance enhancing measures on your TCP services as detailed here: Transmitting the least amount of data over the wire with WCF
Wcf 4.5 RC 支持开箱即用的消息编码器
http://msdn.microsoft.com/en-我们/library/aa751889(v=vs.110).aspx
Wcf 4.5 RC support message encoder out of box
http://msdn.microsoft.com/en-us/library/aa751889(v=vs.110).aspx