Wednesday, September 21, 2011

The maximum message size quota for incoming messages , has been exceeded. To increase the quota,..WCF exception

 

                                        Recently i got this exception when i work with WCF service. One of the Web Method returns heavy data.It is not an issue. The problem hear is  maxReceivedMessageSize is exceeded .         
The Default value of maxReceivedMessageSize is "65536". We can change this value upto "2147483647".I have increased the size of maxBufferSize,maxReceivedMessageSize  in Web.config file (Binding section).

The problem got resolved .

 

maxWCF

 

Note: Don’t copy all the code .Only change the maxBufferSize,maxReceivedMessageSize  as I specified in below .

<binding name="BasicHttpBinding_Service1" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
                    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>

Happy coding ..