none
Buffer size for WCF service

    Question

  • Hi,

    Is there a way to increase the WCF buffer size beyond 2147483647 bytes?  This uploads image files upto a maximum of upto 3MB but how do I pass byte arrays for upto 10 MB at least? I'm using a WCF service to pass the byte array from Silverlight to my database. 

    Thursday, February 04, 2010 1:17 AM

All replies

  • I have basicHttpBinding and in my web.config I've set

    transferMode="Streamed" messageEncoding="Mtom"

    I'm trying to use this mtom encoding but its throwing an exception saying the response message does not match the binding encoding type.

    How and where all do I set this messageEncoding to Mtom? Or If anyone could tell me other ways to transfer upto 20MB data it'd really be great.

    Thursday, February 04, 2010 8:59 AM
  • Ok, here's the problem:

    My web.config snippet:

    <bindings>

    <basicHttpBinding>

    <binding name="MtomHttpBinding"

    maxBufferPoolSize="2147483647"

    messageEncoding="Mtom"

    transferMode="Streamed"

    maxBufferSize="2147483647"

    maxReceivedMessageSize="2147483647"/>

    </basicHttpBinding>

    </bindings>

    <services>

    <service behaviorConfiguration="Mtom_POC.Web.MtomEnabledServiceBehavior" name="Mtom_POC.Web.MtomEnabledService">

    <!--added binding configuration to reflect basichttpbinding tag-->

    <endpoint address="" binding="basicHttpBinding" contract="Mtom_POC.Web.IMtomEnabledService" bindingConfiguration="MtomHttpBinding">

    <identity>

    <dns value="localhost"/>

    </identity>

    </endpoint>

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

    </service>

    </services>

    It seems that when I set message encoding to mtom, my CLIENT CONFIG is blank.  However if I remove the message encoding, the client config has the correct endpoint address.  Any idea why?

     

    Friday, February 05, 2010 12:47 AM
  • I basically just want to know that if basicHttpBinding supports mtom encoding, why does my client config not add the endpoint address when i do an update service reference?

    Friday, February 05, 2010 7:19 AM
  • Hi thanks for ur help but i'm still not able to send large size data.  basicHttpBinding is ok with mtom encoding right?  All the forums i've seen seem to be using wsHttpBinding.  I'm really stuck on this if anyone could help please? 

    Sunday, February 07, 2010 9:21 AM
  • Ok, so what I've noticed is that when I run the application with visual studio, over 2 MB and it gives remote server not found.  However, if I dont run it from VS 2008, ie by opening the browser window seperately and pasting the url, i've managed to connect to the server side for over 5 MB.  This is without setting transfermode=streamed or encoding= mtom. 

    Any idea wy this is happening?

    Monday, February 08, 2010 1:25 AM
  • Hi,
    I am using this config file. i am also getting same error "The remote server returned an unexpected response: (400) Bad Request."
    But i am using TransferdMode ="Buffered".

    This is the config file i am using. Is there any solution for resolving this issue?.


    <system.serviceModel>
       
    <client>
         
    <endpoint address="http://localhost/abc/Services/Package"
           
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_PackageService"
           
    contract="PackageService.PackageService" name="BasicHttpBinding_PackageService" />
       
    </client>
       
    <services>
         
    <!-- This section is optional with the new configuration model
               introduced in .NET Framework 4. -->

         
    <service name="ServiceContracts.SearchServiceContract"
                   
    behaviorConfiguration="SearchServiceBehavior">
           
    <host>
             
    <baseAddresses>
               
    <add baseAddress="http://localhost:8080/xyz/SearchService"/>
             
    </baseAddresses>
           
    </host>
           
    <!-- this endpoint is exposed at the base address provided by host: http://localhost:8080/xyz/SearchService  -->
           
    <endpoint address=""
                     
    binding="wsHttpBinding"
                     
    bindingConfiguration="NoSecurityBinding"
                     
    contract="ServiceContracts.ISearchServiceContract" />
           
    <!-- the mex endpoint is exposed at http://localhost:8080/xyz/SearchService/mex -->
           
    <endpoint address="mex"
                     
    binding="mexHttpBinding"
                     
    contract="IMetadataExchange" />
         
    </service>
         
    <service name="ServiceContracts.PackageServiceContract"
                   
    behaviorConfiguration="PackageServiceBehavior">
           
    <host>
             
    <baseAddresses>
               
    <add baseAddress="http://localhost:8080/xyz/PackageService"/>
             
    </baseAddresses>
           
    </host>
           
    <!-- this endpoint is exposed at the base address provided by host: http://localhost:8080/xyz/PackageService  -->
           
    <endpoint address=""
                     
    binding="wsHttpBinding"
                     
    bindingConfiguration="NoSecurityBinding"
                     
    contract="ServiceContracts.IPackageServiceContract" />
           
    <!-- the mex endpoint is exposed at http://localhost:8080/xyz/PackageService/mex -->
           
    <endpoint address="mex"
                     
    binding="mexHttpBinding"
                     
    contract="IMetadataExchange" />
         
    </service>
       
    </services>
       
    <behaviors>
         
    <serviceBehaviors>
           
    <behavior name="SearchServiceBehavior">
             
    <serviceMetadata httpGetEnabled="true"/>
             
    <serviceDebug includeExceptionDetailInFaults="true"/>
             
    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
           
    </behavior>
           
    <behavior name="PackageServiceBehavior">
             
    <serviceMetadata httpGetEnabled="true"/>
             
    <serviceDebug includeExceptionDetailInFaults="true"/>
             
    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
           
    </behavior>
         
    </serviceBehaviors>
       
    </behaviors>
       
    <bindings>
         
    <basicHttpBinding>
           
    <binding name="BasicHttpBinding_PackageService" closeTimeout="00:01:00"
             
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
             
    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             
    maxBufferSize="268435456" maxBufferPoolSize="268435456" maxReceivedMessageSize="268435456"
             
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
             
    useDefaultWebProxy="true">
             
    <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
               
    maxBytesPerRead="268435456" maxNameTableCharCount="268435456" />
             
    <security mode="None">
               
    <transport clientCredentialType="None" proxyCredentialType="None"
                 
    realm="" />
               
    <message clientCredentialType="UserName" algorithmSuite="Default" />
             
    </security>
           
    </binding>
         
    </basicHttpBinding>
         
    <wsHttpBinding>
           
    <binding name="NoSecurityBinding">
             
    <security mode="None">
               
    <transport clientCredentialType="None" />
               
    <message establishSecurityContext="false" />
             
    </security>
           
    </binding>
         
    </wsHttpBinding>
       
    </bindings>  
     
    </system.serviceModel>


    Is there any solution for resolving this issue?.


    Tuesday, February 21, 2012 1:34 PM