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

て烟熏妆下的殇ゞ 提交于 2019-11-27 03:59:40

问题


I have a wsf service and a client application. While trying to communicate the client and the service I've gotten the following message:

"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:blob. The InnerException message was 'There was an error deserializing the object of type FileBlob. 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 25931.'. Please see InnerException for more details."

I have the customBinding element and it doesn't allow me to insert "readerQuotas" section. In both the client and service configs I have the following binding element:

<customBinding>
  <binding name="LicenseServiceBinding"
                closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
      <security authenticationMode="UserNameOverTransport">
          <localClientSettings maxClockSkew="00:07:00" />
          <localServiceSettings maxClockSkew="00:07:00" />
      </security>
      <windowsStreamSecurity />
      <httpsTransport maxReceivedMessageSize="2147483646"/>          
  </binding>
</customBinding>

Thanks in advance for any help:)


回答1:


Actually, I've solved the problem by adding readerQuotas within textMessageEncoding section. Thanks for the help.

<textMessageEncoding messageVersion="Soap11">
          <readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="5242880"/>
</textMessageEncoding>



回答2:


You should be able to add a <readerQuotas> element inside the <binding> element:

<customBinding> 
  <binding name="LicenseServiceBinding" 
                closeTimeout="00:01:00" openTimeout="00:01:00" 
                receiveTimeout="00:10:00" sendTimeout="00:01:00"> 
      <security authenticationMode="UserNameOverTransport"> 
          <localClientSettings maxClockSkew="00:07:00" /> 
          <localServiceSettings maxClockSkew="00:07:00" /> 
      </security> 
      <readerQuotas maxArrayLength="32768" />
      <windowsStreamSecurity /> 
      <httpsTransport maxReceivedMessageSize="2147483646"/>           
  </binding> 
</customBinding> 

You mentioned that it "doesn't allow me to insert". What error message do you get?



来源:https://stackoverflow.com/questions/3068076/wcf-service-the-maximum-array-length-quota-16384-has-been-exceeded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!