asp.netweb-servicesmaxstringcontentlengthservice-model

ASP.NET web service maximum array length quota


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> 

Solution

  • 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>