WCF compressing JSON response
<p>I have a WCF web service based on JSON and POST method which have a function called website returning a JSON with more 2KB content. This service has more than 10K requests per second. So, I have lots of textual data to be passed via network and I/O. I think I can reduce this volume of data by compressing the response automatically. I know that by setting a header in client side for accepting zipped content, the client  can notify the server that compressed content is acceptable. But how the server can send compressed content?</p>

<p>I have read <a href="https://stackoverflow.com/questions/15680087/how-to-get-gzip-compression-working-in-wcf-4-5">this</a> link, and implement it. But it works only for SOAP which is xml-based, not JSON. I mean that this configuration:</p>

<pre><code>&lt;customBinding&gt;
  &lt;binding name="BinaryCompressionBinding"&gt; 
    &lt;binaryMessageEncoding compressionFormat="GZip"/&gt; 
    &lt;httpTransport /&gt; 
  &lt;/binding&gt;
&lt;/customBinding&gt; 
</code></pre>

<p>can not work with JSON because we have to use <code>binaryMessageEncoding</code>, where as JSON needs <code>webMessageEncoding</code> and it does not support <code>compressionFormat</code>.</p>

<p>Also, IIS dynamic compression can not help me too. I have added markup it needs to compress JSON.</p>

<hr>

<p><strong>Update:</strong>
This is my applicationhost.config: </p>

<pre><code>&lt;httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" minFileSizeForComp="0"&gt; &lt;scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /&gt; &lt;dynamicTypes&gt; &lt;add mimeType="application/json" enabled="true" /&gt; &lt;add mimeType="application/json; charset=utf-8" enabled="true" /&gt; &lt;/dynamicTypes&gt; &lt;/httpCompression&gt;
</code></pre>