December 26, 2018

WCF - Increase message size quota for incoming messages.

You may encounter this error message while receving larger resultset from WCF service:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

By default the client application supports the message size 65536. To fix this error you have to increase this default limit.

In App.config or Web.config file of the client application, change/add attributes of the binding tag as below:

 <bindings>
  <basicHttpBinding>
   <binding name="basicHttp" allowCookies="true"
      maxReceivedMessageSize="20000000" 
      maxBufferSize="20000000"
      maxBufferPoolSize="20000000">
    <readerQuotas maxDepth="32" 
      maxArrayLength="200000000"
      maxStringContentLength="200000000"/>
   </binding>
  </basicHttpBinding>
 </bindings>

Here I increased the default value of maxReceivedMessageSize to 20000000.

No comments:

Post a Comment