Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

WCF Problem with CustomBinding and GZip

$
0
0

Hi,

I have to migrate a Silverlight application to WPF and now I have a problem with the WCF configuration. I need a way to compress the data. In Silverlight I did this with the CompressedHost / CompressedProxy and SharpZipLib.

WCF 4.5 supports GZip compression without third party libraries. So I wanted to use this feature. But the configuration with CustomBinding has not been working. I believe that CSLA does not use my own binding, but I don't know how to bring it.

The WCF error message is: 
Content Type "application/soap+xml; charset=utf-8"  was sent to a service expecting "application/soap+msbin1+gzip". The client and service bindings may be mismatched. 

 

My server configuration (web.config):
Note: The commented part (wsHttpBinding) would work, but without compression. 

<configuration>
    <appSettings>
      <add key="CslaAuthentication" value="Custom" />
      <add key="DalManagerType" value="Csla.Server.Hosts.WcfPortal,PAPMS.ProductLib.Business" />
    </appSettings>
    <system.serviceModel> 
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
        <services>
            <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="returnFaults">
                <endpoint binding="customBinding" bindingConfiguration="CustomBinding_IWcfPortal" contract="Csla.Server.Hosts.IWcfPortal" />
                <!--<endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IWcfPortal" contract="Csla.Server.Hosts.IWcfPortal" />-->
            </service>
        </services>
        <bindings>
            <customBinding>
                <binding name="CustomBinding_IWcfPortal">
                    <binaryMessageEncoding compressionFormat="GZip"/>
                    <httpTransport decompressionEnabled="true" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
                </binding>
            </customBinding>
            <!--<wsHttpBinding>
                <binding name="wsHttpBinding_IWcfPortal" maxReceivedMessageSize="2147483647" >
                     <readerQuotas maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647" maxDepth="2147483647" />
                </binding>
           </wsHttpBinding>-->
       </bindings>
       <behaviors>
           <serviceBehaviors>
               <behavior name="returnFaults">
                   <serviceDebug includeExceptionDetailInFaults="true" />
                   <serviceMetadata httpGetEnabled="true" />
               </behavior>
           </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
    <system.web>
        <compilation debug="true" targetFramework="4.5" />
    </system.web>
</configuration>

 

My client configuration (app.config):

<configuration>
    <appSettings>
         <add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla" />
         <add key="CslaDataPortalUrl" value="http://localhost/PAPMS.WcfServer/WcfPortal.svc" />  
    </appSettings>
    <system.serviceModel>
        <client>
            <endpoint binding="customBinding" address="http://localhost/PAPMS.WcfServer/WcfPortal.svc" bindingConfiguration="CustomBinding_IWcfPortal" contract="Csla.Server.Hosts.IWcfPortal" name="CustomBinding_IWcfPortal" />
       </client>
       <bindings>
           <customBinding>
                 <binding name="CustomBinding_IWcfPortal">
                     <binaryMessageEncoding compressionFormat="GZip" />
                     <httpTransport decompressionEnabled="true" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
                 </binding>
            </customBinding>
        </bindings>
    </system.serviceModel>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

 

As a side note, I use CSLA 4.5.501.

I would be very happy if someone could help me. Thank you in advance!

Best Regards, Adrian


Viewing all articles
Browse latest Browse all 764

Trending Articles