ASP.NET Web服务最大数组长度配额

时间:2013-09-11 12:15:01

标签: asp.net web-services maxstringcontentlength service-model

我在收到客户端文件的ASP.NET Web服务中收到此错误:

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.

我知道如何为WCF服务修复此问题。但是,我必须在ASP.NET Web服务中更改maxArrayLengthmaxStringContentLength

修改

在我的web.config(服务器)中,没有任何特定于Web服务。

这是我在app.config(客户端)中的绑定:

  <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 个答案:

答案 0 :(得分:4)

试试这个

<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 :(得分:-2)

下的<system.serviceModel>

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