ADesai
ADesai

Reputation: 1

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

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.

Upvotes: 0

Views: 39

Answers (1)

QI You
QI You

Reputation: 518

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

Upvotes: 0

Related Questions