ak_tyagi
ak_tyagi

Reputation: 1602

"The 'maximum bytes per Read operation' quota (4096) has been exceeded while reading XML data. Long element start tags may trigger this quota

This is my app.config->

<bindings>
       <basicHttpBinding>
         <binding messageEncoding="Mtom" />
      <binding name="requestPTPDocumentForInvBasketSchemaSoap11" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="409600"
        maxBytesPerRead="409600" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
  <customBinding>
    <binding name="CustomBindingEndPoint">
      <textMessageEncoding messageVersion="Soap11WSAddressing10" />
      <security defaultAlgorithmSuite="TripleDesRsa15" authenticationMode="MutualCertificate"
        securityHeaderLayout="Lax" includeTimestamp="false" messageProtectionOrder="SignBeforeEncrypt"
        messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
        <issuedTokenParameters keyType="AsymmetricKey" />
        <localClientSettings detectReplays="false" />
        <secureConversationBootstrap />
      </security>
      <httpTransport maxReceivedMessageSize="2147483647" />
    </binding>
  </customBinding>
</bindings>'

The error i am getting is ->{"The 'maximum bytes per Read operation' quota (4096) has been exceeded while reading XML data. Long element start tags (consisting of the element name, attribute names and attribute values) may trigger this quota. This quota may be increased by changing the MaxBytesPerRead property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 5305." While consuming JAVA web service i am getting the above error.Please advice

Upvotes: 2

Views: 1989

Answers (1)

Jasper
Jasper

Reputation: 1837

Came across this old question searching for the same thing. Found this post: https://social.msdn.microsoft.com/Forums/vstudio/en-US/b7d25a12-529c-4217-b7bd-d4b35be608ed/how-to-increase-maxbytesperread-and-related-properties-in-code?forum=wcf which advises to set ReaderQuotas.MaxBytesPerRead to a high number like 409600, because apparently int.MaxValue isn't accepted. Changing the proposed value fixed the issue for me.

Upvotes: 2

Related Questions