Recently we tried to call a WCF service with a relatively large XML message request (162 KB) and saw an interesting error message from the client: System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request Since all other smaller requests were getting processed with no problem, we were hitting some kind of limit. It turns out the maximum default message size that WCF processes is 65 KB. Adjusting this to 10 MB on the server side fixed this for us:
 <bindings>
  <wsHttpBinding>
          <binding name="WSHttpBinding_IService" maxReceivedMessageSize="10000000">
          </binding>
   </wsHttpBinding>
 </bindings>
Some other limits that may come into play with large messages depending on your message structure are the reader quotas for both the WCF client and service:
<bindings>
 <wsHttpBinding>
        <binding name="WSHttpBinding_IService" maxReceivedMessageSize="10000000" >
         <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                       maxBytesPerRead="4096" maxNameTableCharCount="16384" />
   </binding>
 </wsHttpBinding>
</bindings>

Share