Maximum message size quota for incoming messages exceeded (65536)

I get this exception by creating an area for multiple tables, all of these tables are huge in design

<bindings> <wsHttpBinding> <binding name="wsHttpBinding_ISyncServices" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""> <extendedProtectionPolicy policyEnforcement="Never" /> </transport> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsHttpBinding> </bindings> 

I did MaxReceivedMessageSize to 2147483647 but still it gives me below exceptions in this line

  client.GetTableDescription(scopeName, syncTable) 

Exceeded maximum message size quota for incoming messages (65536).
To increase the quota, use the MaxReceivedMessageSize property in the corresponding binding element.

+64
Mar 28 '11 at 13:30
source share
9 answers

According to the answer to this question

You need something like this:

 <bindings> <basicHttpBinding> <binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000"> <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/> </binding> </basicHttpBinding> </bindings> 

Please also read the comments on the accepted answer containing valuable input.

+102
Mar 28 '11 at 13:33
source share
— -

You also need to increase maxBufferSize . Also note that you may need to increase readerQuotas .

+12
Mar 28 '11 at 13:32
source share

You need to make changes to the binding configuration (in the app.config file) on SERVER and CLIENT, or it will not take effect.

 <system.serviceModel> <bindings> <basicHttpBinding> <binding maxReceivedMessageSize="2147483647 " max...=... /> </basicHttpBinding> </bindings> </system.serviceModel> 
+9
Mar 28 2018-11-21T00:
source share

If you use CustomBinding, you will need to make changes to the httptransport element. Set it as

<customBinding> <binding ...> ... <httpsTransport maxReceivedMessageSize="2147483647"/> </binding> </customBinding>

+8
Aug 22 '15 at 9:53 on
source share

This worked for me:

  Dim binding As New WebHttpBinding(WebHttpSecurityMode.Transport) binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None binding.MaxBufferSize = Integer.MaxValue binding.MaxReceivedMessageSize = Integer.MaxValue binding.MaxBufferPoolSize = Integer.MaxValue 
+5
Apr 10 '15 at 17:27
source share

Making changes to config did not help me. After a well-established pace

 private YourAPIClient GetClient() { Uri baseAddress = new Uri(APIURL); var binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 20000000; binding.MaxBufferSize = 20000000; binding.MaxBufferPoolSize = 20000000; binding.AllowCookies = true; var readerQuotas = new XmlDictionaryReaderQuotas(); readerQuotas.MaxArrayLength = 20000000; readerQuotas.MaxStringContentLength = 20000000; readerQuotas.MaxDepth = 32; binding.ReaderQuotas = readerQuotas; if (baseAddress.Scheme.ToLower() == "https") binding.Security.Mode = BasicHttpSecurityMode.Transport; var client = new YourAPIClient(binding, new EndpointAddress(baseAddress)); return client; } 
+2
Sep 10 '17 at 8:54 on
source share

My solution was to use the "-OutBuffer 2147483647" parameter in my request, which is part of the general parameters. PS C:> Get-Help about_CommonParameters -Full

0
Aug 19 '15 at 18:32
source share

For me, the settings in web.config / app.config were ignored. In the end, I created my binding manually, which solved the problem for me:

 var httpBinding = new BasicHttpBinding() { MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, ReaderQuotas = new XmlDictionaryReaderQuotas() { MaxArrayLength = 200000000, MaxDepth = 32, MaxStringContentLength = 200000000 } }; 
0
Feb 12 '19 at 6:00
source share

You can partially solve this problem using MTOM (Message Transmission Optimization Mechanism) message encoding as well. The default message encoding mechanism in WCF is text that base64 encodes data, Base64 encoding increases the message size by about 33%.

MTOM does not encode base64 data. It also means that the extra processing overhead for base64 encoding and data decoding is removed. Therefore, MTOM can significantly improve overall messaging performance.

When encoding text messages, binary data is encoded in base64 format and embedded in a SOAP envelope. In MTOM, binary data is included as an MIME (Internet Mail Multipurpose Extension) attachment.

This can be configured as follows in the configuration file.

 <bindings> <wsHttpBinding> <binding name="wsHttp" messageEncoding="Mtom" maxReceivedMessageSize="700000"> <readerQuotas maxArrayLength="700000"/> </binding> </wsHttpBinding> </bindings> 

You can compare and see that the bytes received using MTOM are significantly smaller compared to text message encoding.

0
Sep 19 '19 at 10:22
source share



All Articles