Windows Service “self hosted” WCF : compression?

独自空忆成欢 提交于 2019-12-10 18:04:53

问题


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.


回答1:


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:

  • Binary Http Binding by Nicolas Allen (member of the WCF team at Microsoft)
  • Silverlight 3 WCF Binary Message Encoding
  • WCF Binary Bindings in Silverlight 3 by John Papa (Silverlight envangelist)
  • WCF: Enable Binary Encoding Over Http


来源:https://stackoverflow.com/questions/3206132/windows-service-self-hosted-wcf-compression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!