Print Page | Close Window

Ideablade compression on a non-ideablade project

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3316
Printed Date: 16-Apr-2024 at 1:28am


Topic: Ideablade compression on a non-ideablade project
Posted By: pponzano
Subject: Ideablade compression on a non-ideablade project
Date Posted: 05-Mar-2012 at 12:47am
Hello,
I've got a silverlight 4 application that uses WCF services (not RIA) to fetch data... I would like to apply Gzip compression, it's possible to use

   <add name="gzipMessageEncoding" type="IdeaBlade.Core.Wcf.Extensions.GZipMessageEncodingElement, IdeaBlade.Core" />

just for compression itself?

what assembly should I reference?
Since I declare the proxy by codebehind (specifing CutomBinding and so on) how do I add a bindingelementexpression programmatically?

Thanks



Replies:
Posted By: sbelini
Date Posted: 05-Mar-2012 at 5:22pm
Hi Paolo,
 
In theory you should be able to use the compression with no issues.
 
Be sure to add the IdeaBlade.Core assembly.
 
To add binding programmatically, create the CustomBinding and use the Gzip binding element in place of the usual binding element: ( http://social.msdn.microsoft.com/Forums/en/wcf/thread/2205b22c-b582-4771-a361-ee9b85fc0493 - http://social.msdn.microsoft.com/Forums/en/wcf/thread/2205b22c-b582-4771-a361-ee9b85fc0493 )

var binding = new CustomBinding(new GZipMessageEncodingBindingElement(), new HttpTransportBindingElement());
 
Or you could simply do it in your config file: (from one of our config file samples in the http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-configuration-files - DevForce Resource Center )
 
  <system.serviceModel>
 
    <bindings>
      <customBinding>
        <binding name="compressedBinaryBinding"
                 closeTimeout="00:01:00"
                 openTimeout="00:01:00"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:01:00">
          <gzipMessageEncoding>
            <readerQuotas
                 maxDepth="2147483647"
                 maxStringContentLength="2147483647"
                 maxArrayLength="2147483647" />
          </gzipMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
    <extensions>
      <bindingElementExtensions>
        <add name="gzipMessageEncoding"
             type="IdeaBlade.Core.Wcf.Extensions.GZipMessageEncodingElement, IdeaBlade.Core"/>
      </bindingElementExtensions>
    </extensions>
  </system.serviceModel>
 
 
Regards,
   Silvio.



Print Page | Close Window