Reputation: 81352
I am getting this error:
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.
How can I increase this value in the WCF client application or the server application, and if possible an example of how this is done?
Upvotes: 11
Views: 21263
Reputation: 2101
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_Username" maxReceivedMessageSize="20000000" maxBufferPoolSize="20000000">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" establishSecurityContext="false"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint
binding="wsHttpBinding"
bindingConfiguration="wsHttpBinding_Username"
contract="Exchange.Exweb.ExchangeServices.ExchangeServicesGenericProxy.ExchangeServicesType"
name="ServicesFacadeEndpoint" />
</client>
Upvotes: 1
Reputation: 4381
You need to set the MaxReceivedMessageSize attribute in your binding configuration. By default, it is 65536. I assume you're using data sets or something of that nature that end up being pretty large (mostly because they're represented with XML usually).
The good news is that I think you only need to change this in your client configuration. Take a look below.
<bindings>
<netTcpBinding>
<binding name="MyTcpBinding"
maxReceivedMessageSize="2000000"/>
</netTcpBinding>
<bindings>
Upvotes: 3
Reputation: 1039498
You increase it on the client side in app/web.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="WSBigQuotaConfig" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2097152" maxArrayLength="2097152" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint
address="http://example.com/endpoint.svc"
binding="basicHttpBinding"
bindingConfiguration="WSBigQuotaConfig"
contract="ISomeServiceContract" />
</client>
</system.serviceModel>
Upvotes: 19