ASP.NET web service maximum array length quota

3.3k views Asked by At

I'm gettingg this error in an ASP.NET web service whene recieving a file on the client:

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.

I know how to fix this for a WCF service. But where do I have to change maxArrayLength or maxStringContentLength in a ASP.NET web service?

Edit:

In my web.config (server) there is nothing specific to the web service.

this is my binding in app.config (client):

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="OMCServiceSoap" maxReceivedMessageSize="10000000" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/1820/Service/OMCService.asmx"
        binding="basicHttpBinding" bindingConfiguration="OMCServiceSoap"
        contract="ServiceReference.OMCServiceSoap" name="OMCServiceSoap" />
    </client>
  </system.serviceModel> 
2

There are 2 answers

1
Ajay On BEST ANSWER

Try this

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="OMCServiceSoap" maxReceivedMessageSize="10000000">
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost/1820/Service/OMCService.asmx"
    binding="basicHttpBinding" bindingConfiguration="OMCServiceSoap"
    contract="ServiceReference.OMCServiceSoap" name="OMCServiceSoap" />
</client>
</system.serviceModel> 
1
Sankar M On

under <system.serviceModel> like below

    <bindings>
          <basicHttpBinding>
                 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
 </basicHttpBinding>
    </bindings>