How to Compress the WCF service response using GZIP in c#?

30 Views Asked by At

There is a new requirement where I need to Compress the WCF service response in GZIP format and send it to partner systems in C#. How can I achieve this ?

I have tried adding the configurations in web.config file. But it didnt work.

1

There are 1 best solutions below

0
QI You On

I offer you two options:

1.You can use custom bindings to achieve this

<customBinding>
  <binding name="GzipBinding"> 
    <binaryMessageEncoding compressionFormat="GZip"/> 
    <httpTransport /> 
  </binding>
</customBinding>

2.Using GZip Encoder, here are the relevant demo documents and examples

GZip Encoder Sample