Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As @Igby Largeman pointed out, you can use your <code>IIS7</code> to enable the compression on the server, but this is not enough.<br> The main idea is to set the headers on the client side <strong>and</strong> server side:</p> <p><strong>Client</strong>:</p> <pre><code>Accept-Encoding = "gzip, deflate"; </code></pre> <p>You can achieve this by code:</p> <pre><code>var request = HttpWebRequest.Create("http://foofoo"); request.Headers["Accept"] = "application/json"; request.Headers["Accept-Encoding"] = "gzip, deflate"; </code></pre> <p>or </p> <pre><code>var request = HttpWebRequest.Create("http://foofoo"); request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; </code></pre> <p>If you use some WCF client, and not the <code>HttpWebRequest</code>, you should use custom inspector and dispatcher, like in <a href="http://bloggingabout.net/blogs/ramon/archive/2008/11/06/wcf-and-http-gzip-deflate-compression-and-silverlight.aspx" rel="nofollow">this article</a>:</p> <blockquote> <p>So I used a message inspector implementing <code>IClientMessageInspector</code> and <code>IDispatchMessageInspector</code> to automatically set the <code>AcceptEncoding</code> and <code>ContentEncoding</code> http headers. </p> <p>This was working perfectly but I could not achieve to decompress the response on the server by first detecting the <code>ContentEncoding</code> header thus I used the work around to first try to decompress it and if it fails just try to process the request as normal. </p> <p>I also did this in the client pipeline and this also works.</p> </blockquote> <p><strong>Server</strong>:</p> <pre><code>// This is the nearly same thing after all Content-Encoding = "gzip" OR Content-Encoding = "deflate" </code></pre> <p>To do this on the Server side, you should enable httpCompression in the IIS.<br> I think you should check the <a href="http://www.hanselman.com/blog/EnablingDynamicCompressionGzipDeflateForWCFDataFeedsODataAndOtherCustomServicesInIIS7.aspx" rel="nofollow">original article</a> to get this work</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload