4

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.

Kyle
  • 963
  • 3
  • 16
  • 32

1 Answers1

3

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:

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/ca7287b4-f553-4c8f-bc0f-1ef68a5e420e was one that I had found, it seems as good a place to start as any. I was hoping by now there was a canned way to do this. – Kyle Jul 08 '10 at 17:54
  • Well, WCF offers a lot of extensibility points, to plug those kind of things in - where and when needed. – marc_s Jul 08 '10 at 17:56
  • 1
    For what it's worth, WCF 4.0 clients support GZip decompression, so you only need to build your own server compression. Server Compression will be added in the next version – Panagiotis Kanavos Jul 09 '10 at 14:19