I have a WCF web service that is accepting some custom objects and a number of documents sent as byte arrays.
But each time I send a document (not a particularly large one) the WS returns a 400 bad request, and in the trace log it appears to have thrown a MaxReceivedMessageSizeExceeded.
saying
System.ServiceModel.ProtocolException:
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.
Now the client app has this in its app.config
<wsHttpBinding>
<binding name="WSHttpBinding_IReferrals"
closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32"
maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
and in the WCF web.config I have this
<service behaviorConfiguration="WCFReferrals.Service1Behavior"
name="WCFReferrals.Referrals">
<endpoint address="" binding="wsHttpBinding" contract="WCFReferrals.IReferrals">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange" />
</service>
....
<binding name="wsHttpBinding" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</binding>
Clearly I am missing something as as far as I can see I have all the max message limits set waaaaay over what is necessary..
Any help would be happily received
thanks
nat
First of all: on your server side, you define the binding configuration with larger message size, but you don’t reference it from your endpoint.
Also: are you doing the same thing on your client-side? Does your client-side config (
app.configorweb.config) also include that large message size binding configuration? Are you referencing that binding configuration in your<client> .. <endpoint>element??