views:

10

answers:

2

I have a WCF service that returns a lot of data. So much so that I needed to increase the maxBufferSize and the maxReceivedMessageSize. My endpoint and binding look like so:

<endpoint 
    address=""
    binding="basicHttpBinding"
    bindingConfiguration="ExtendedBinding"
    contract="NAThriveExtensions.INableAPI"
/>

<bindings>
  <basicHttpBinding>
    <binding
       name="ExtendedBinding"
       maxBufferSize="655360"
       maxReceivedMessageSize="655360" >
    </binding>
  </basicHttpBinding>
</bindings>

As far as I can tell the above is configured correctly. When I access my webSerice through the WCFTestClient (with the service either being hosting in VS or IIS) I check the config and

1) The client section does not have the name of my bindingConfiguration in it

<client>
    <endpoint
       address="http://wikittybam/NAThriveExtensions/NableAPI.svc"
       binding="basicHttpBinding" 
       bindingConfiguration="BasicHttpBinding_INableAPI"
       contract="INableAPI" name="BasicHttpBinding_INableAPI" />
</client>

2) The binding that gets sucked into the client does not have an updated maxZBufferSize or maxReceivedMessageSize, and transport and message security stubs are being pulled over somehow.

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_INableAPI" closeTimeout="00:01:00"
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
       allowCookies="false" bypassProxyOnLocal="false"      
       hostNameComparisonMode="StrongWildcard"
       maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
       messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
       useDefaultWebProxy="true">
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
         maxBytesPerRead="4096" maxNameTableCharCount="16384" />
         <security mode="None">
           <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
           <message clientCredentialType="UserName" algorithmSuite="Default" />
         </security>
    </binding>
  </basicHttpBinding>
</bindings>

I know that bindingConfiguration works as I was able to test transport security through the WCFTestClient. Any insight would be appreciated.

Thanks!

+1  A: 

As far as I remember, that detail of binding parameters are not publicly exposed in the published metadata. The only reason why the service proxies generated using VS/Svcutil contain all that is because, well, they are very dumb and serialize the binding configurations with all the values, even though all of them contain the standard default values!

IOW, you're going to have to manually tweak your client configuration.

tomasr
+1 correct answer.
Ladislav Mrnka
Thanks. The application that consumes my WCF service is not .Net based and everything works fine when I consume the service within that application. Sucks from a testing perspective, but glad it works.
Matt
A: 

Not all binding parameters are transfered. Morover message size configuration is defense against denial of service attack so each service and client can have its own configuration and it will be bad if this configuration is overwritten each time you regenerate proxy. It is called maxReceiveMessageSize so it only checks the size of incomming messages. You have to set this parameter to expected size of message on receiving side. For example if you only plan to download large dataset from the service you don't need to configure high value on that service side because it will not receive this dataset it will send it. On the client side you have to set this parameter otherwise message will not be processed.

Ladislav Mrnka