browse by category or date

I encountered this error when trying to invoke a data retrieval method of a third-party web service. The method supposed to return us a ZIP file. The full error message is:

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.

It means the response given by the web service is too big, exceeding the default response length limit which is 65536 bytes ( 64 KB ).

In order to fix this problem, we need to open our web.config / app.config and find section which contains the web service reference. It should be something similar to:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
              <binding name="EntitySoap">
                <security mode="Transport" />
              </binding>              
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://mywebsite.com/WebServices/DataService.asmx"
                binding="basicHttpBinding" bindingConfiguration="EntitySoap" 
                contract="MyNamespace.EntitySoap" name="EntitySoap" />
        </client>
    </system.serviceModel>
</configuration>

Now we need to specify the new limit for the response length. As the error message suggested, we do it by adding maxReceivedMessageSize property to binding tag. In the example below, I don’t know what the maximum file size would be. So I set it to the maximum value permitted, which is the max value of int ( 2 GB ):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
              <binding name="EntitySoap" maxReceivedMessageSize="2147483647">
                <security mode="Transport" />
              </binding>              
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://mywebsite.com/WebServices/DataService.asmx"
                binding="basicHttpBinding" bindingConfiguration="EntitySoap" 
                contract="MyNamespace.EntitySoap" name="EntitySoap" />
        </client>
    </system.serviceModel>
</configuration>

That’s all folks. I hope it helps!

GD Star Rating
loading...
[SOLVED] The maximum message size quota for incoming messages (65536) has been exceeded., 3.0 out of 5 based on 1 rating

About Hardono

Hi, I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

No Comment

Add Your Comment