WCF service :The maximum array length quota (16384) has been exceeded.

I was working in my project and in my project WCF service was used. While running the application I got an error message like

"The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 120363.'.  Please see InnerException for more details."



This was my service binding configuration 

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
Solution:

I just changed the "maxArrayLength" attribute in the configuration file and it worked fine for me.

Here is my new configuration file 

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
      </security>
    </binding>
  </basicHttpBinding>
</bindings>


Hope this will be helpfull . Happy coding :)

Comments

Popular posts from this blog

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

The transaction is aborted or Failure while attempting to promote transaction.

Unable to load one or more breakpoints in Visual studio.