I am developer and technology maniac who is working on Microsoft and PHP technologies. I have ASP.NET MVP title and I hold MCAD, MCSD and MCTS certificates. When I have free time I usually play with new technologies, hack something, read books, participate in communities and speak in events. I am also active blogger and my ASP.NET blog is the place you can find some interesting reading about my discoveries and personal thoughts. Gunnar is a DZone MVB and is not an employee of DZone and has posted 136 posts at DZone. You can read more from them at their website. View Full User Profile

WCF: The maximum message size quota for incoming messages (65536) has been exceeded

11.08.2010
| 8683 views |
  • submit to reddit

When using WCF services you may get the following 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." This error is given because of size limits set to responses in your application configuration.

You need to increase the value of two limiting parameters: maxBufferSize and maxReceivedMessageSize. In my example these values are set to 5000000.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding
name="MyServiceConsumerBinding"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="5000000"
maxBufferPoolSize="524288"
maxReceivedMessageSize="5000000"
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>
<client>
<endpoint
address="http://localhost:12221/"
binding="basicHttpBinding"
bindingConfiguration="MyService"
contract="MyService.MyServiceInterface"
name="MyServiceConsumer" />
</client>
</system.serviceModel>
</configuration>

After increasing these values your service requests should work normally.

References
Published at DZone with permission of Gunnar Peipman, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Hassan Turhal replied on Sun, 2012/09/16 - 2:52am

Hi,

Your article seems good but I have rest service & I post huge data from client.

I have made suggest configuration by you in my REST WCF Service but I still have the same.

So do I need to add any thing else at my client. But my client call is simple HTTPRequest Call

Are you new to Java? 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.