0
votes

Having scoured the internet and StackOverflow, I have yet to come across a solution that works. When attempting to read a response I'm getting, the inner exception is:

The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.

I am a client contacting a server and I am receiving a response back that, after looking at the response, is much larger than the 8192 limit. I have updated my client config to the max level but it hasn't helped. I'm out of ideas as to where to update the limit so any help would be appreciated:

Client Config:

<configuration>
  <system.serviceModel>
    <client>
      <endpoint name="CaqhCore_EndpointWithCertificates" address="https://MyEndPoint" behaviorConfiguration="Cbc_BehaviorWithCertificateSigning" binding="customBinding" bindingConfiguration="Cbc_BindingWithCertificates" contract="CORETransactions">
        <identity>
          <certificateReference findValue="1h 1h 1h 1h 1h 1h 1h 1h 1h 1h" x509FindType="FindByThumbprint" />
        </identity>
      </endpoint>
    </client>
    <bindings>
      <customBinding>
        <binding name="Cbc_BindingWithCertificates" maxReceivedMessageSize="2147483647">
          <security enableUnsecuredResponse="false" allowSerializedSigningTokenOnReply="true" authenticationMode="MutualCertificate" requireDerivedKeys="false" includeTimestamp="true" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
            <issuedTokenParameters keyType="AsymmetricKey" />
            <secureConversationBootstrap>
              <issuedTokenParameters keyType="AsymmetricKey" />
            </secureConversationBootstrap>
          </security>
          <textMessageEncoding messageVersion="Soap12WSAddressingAugust2004" writeEncoding="utf-8">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </textMessageEncoding>
          <httpsTransport />
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>
</configuration>

Please note, I have removed information from the config that I don't feel is pertinent due to privacy issues but please let me know if you need to see other pieces like the behaviours or other elements.

1

1 Answers

0
votes

I've found the answer. The issue was that the code I was working with (not written by me) had the code containing the object: XmlDictionaryReaderQuotas commented out, which meant it was not able to read the readerQuotas node from the config file and therefore was using default values.