9

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.

Bohemian
  • 412,405
  • 93
  • 575
  • 722
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
  • Is that your server's web.config file? Because the error message seems to be coming from the client (it's an error deserializing the reply). What's your client code? – Dan Puzey Aug 02 '11 at 18:58
  • Are you sure that your service / client is using the configuration? Can you post both the error stack trace and the *full* configuration file (with the definition as well)? – carlosfigueira Aug 02 '11 at 20:28
  • You may need to check your client configurations. – Jack Aug 03 '11 at 00:48

2 Answers2

15

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.

Tim
  • 28,212
  • 8
  • 63
  • 76
1

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

amit
  • 2,093
  • 16
  • 10
  • These are all good answers. What really happened is that I was indeed not putting the name of the binding in my endpoint element, and I was adding the service to my project via the service refrence tool. I think that sets some attributes to the defaults. I changed those values and everything seems to work. – SoftwareSavant Aug 03 '11 at 12:09