Windows 服务“自托管” WCF:压缩?
在 IIS 中使用 WCF 压缩我可以找到文档,但它面向使用 IIS 功能。
我可以找到人们谈论他们如何编写自己的压缩处理程序,但这一切看起来都很定制。
是否有压缩 WCF 的最佳实践?我们正在使用 http 绑定。
编辑:将其设置为维基。
Using compression with WCF in IIS I can find documentation for, but its oriented towards using IIS features.
I can find people talking about how they've written their own compression handlers, but it all looks pretty custom.
Is there a best practice around compressing WCF? We're using http bindings.
Edit: setting this as a wiki.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有任何现成的东西可以帮助您解决此问题。
您确实可以为 WCF 实现您自己的压缩扩展 - 有几个人已经做到了,您应该能够使用您最喜欢的搜索引擎找到它。
但是,您可以为绑定做的最好的事情 - 只要您的客户端都在您的控制之下并且您可以轻松配置它们 - 就是使用二进制消息编码而不是消息的文本表示。
您可以轻松地将二进制消息编码与 http 传输结合起来 - 您需要自定义绑定,但这根本不是什么大问题。很多人也这样做了 - 因此您可以从已经完成的工作中受益:
There's nothing out of the box to help you with this.
You can indeed implement your own compression extensions for WCF - several folks have done it, and you should be able to find it using your favorite search engine.
But the best thing you could do for your bindings - as long as your clients all are under your control and you can easily configure them - would be to use binary message encoding vs. textual representations of messages.
You can easily combine binary message encoding with http transport - you need a custom binding, but that's really not a big deal at all. Lots of folks have done that, too - so you can benefit from work that's already been done: