WS-Compression for WCF

I have developed a new WS-Compression implementation for WCF.  This code is based on the WSE 3.0 implementation  made by my partner Rodolfo Finochieti.


Some features provided by this implementation:


  • Message body compression
  • Different compression algorithms (GZIP, Deflate)
  • Different compression levels
  • Support to enable compression by means of configuration or code


You can download it from here

UPDATED: A new version for the WCF september RC is available here

Enjoy :)


  • Hi,

    Could you please send any document on this. I am usig Feb CTP and in config file m getting below error: <compression .. is not a valid element.

    also in WSCompression.cs u are using some static class variable having link to the weblogs. I am not able to understand these llso.

    Waiting for your response

    Dileep Agarwal

  • i am trying to send attachments from my client app to my service app in WCF with the help of the samle provided above.

    I am using Beta2. But when i try to add service reference to the client in that sample i am getting an exception stating "Compression Header is missing" in "AsyncResult.cs" file. Could someone let me know on which CTP the sample was developed on? . let me know is there any other sample available for sending the attachments?.

  • I have problems using this code on Named Pipes transport, have you tested this code on this transport?

  • Hi Andres,
    No, I haven't tested the code with that transport. The code is hooking up in the transport layer (Bindings) to compress the message, and that can bring many problems. I planning to move the compression functionality to the service layer (Behaviors). Rodolfo Finocheiti have a version implemented in that layer,

  • When I inspect the WCF Trace I get *Stream* instead of the parameters, unless I return a buffered copy of the message.(see code below)
    Any ways to optimize it?

    // Force display of the parameters into the WCF logs

    MessageBuffer buffer = message.CreateBufferedCopy(int.MaxValue);
    message = buffer.CreateMessage();

  • Is this based on http 1.1 http compression thus compression on the http transport data and not a custom message?

Comments have been disabled for this content.