Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The maximum string content length quota (8192)

Error in deserializing body of reply message for operation 'CreateTransactionEntity'. 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.

Hey, I keep getting this error even though I have a larger-than-life readerQuota node on my web.config file...

<system.serviceModel>
<bindings>
  <netTcpBinding>
    <binding name="BindingTcp"  maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" closeTimeout="00:10:00">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                  maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </netTcpBinding>

After browsing the internet on the subject, I can't seem to come up with a decent answer. If you have any advice I would really appreciate it.

like image 514
SoftwareSavant Avatar asked Aug 02 '11 18:08

SoftwareSavant


2 Answers

In order to ensure the values you specify for the binding are picked up, you must assign the Name of the binding from the <binding> element to the bindingConfiguration attribute of the the <endpoint> element. If you don't, WCF will use the default values for the specified binding.

<system.serviceModel>
  <bindings>
    <netTcpBinding>
      <binding name="BindingTcp"  maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" closeTimeout="00:10:00">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      </binding>
    </netTcpBinding>

In the example above, you have assigned "BindingTCP" as the name in your <binding> element. So in your endpoint do this:

<endpoint address="net.tcp://some.website.url/yourserivce" binding="netTcpBinding" bindingConfiguration="BindingTCP" contract="IYourContract" />

Depending on where the error is (on the client or on the server) will determine which config file needs to be modified. If the error is happening on both ends, modify both config files.

like image 97
Tim Avatar answered Oct 20 '22 15:10

Tim


You should check your client application to know if it uses default binding configuration. The quicker way to confirm this is to capture WCF traces at verbose level and check events of Construct ChannelFactory activity.

HTH, Amit Bhatia

like image 1
amit Avatar answered Oct 20 '22 15:10

amit