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

41.4k views Asked by At

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:)

2

There are 2 answers

1
Dmitry Baranovsky On

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>
1
Richard Szalay On

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?