The maximum string content length quota (8192) has been exceeded while reading XML data

The bindingConfiguration needs to have the name you assign to the netTcpinding element – “LargeBuffer” or “LongFields” won’t mean anything unless there is a binding element in the config file with that name. That is why your service won’t start when you put that in – you most likely got a configuration error message of some sort, I bet.

To override the default 8192 setting for maxStringContentLength do this:

  1. Create a Binding element in the config file that has the size you want for maxStringContentLength and give it a name in the name attribute.
  2. In the endpoint element, assign the name from step 1 above to the attribute bindingConfiguration.

If you don’t specify a binding configuration for the endpoint, the service will use the default values.

For example, take your config file above. Under the tag, add the following binding configuration (note that your specific values and the optional attributes you use will vary depending on the needs of your service):

<bindings>
  <netTcpBinding>
    <binding name="ExStreamWCFBinding" closeTimeout="00:00:05" openTimeout="00:00:05" receiveTimeout="00:00:05" sendTimeout="00:00:05" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparison="StrongWildCard" maxBufferPoolSize="524288" maxBufferSize="524288" maxConnections="10" maxReceivedMessageSize="5242880">
      <readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
  </netTcpBinding>
</bindings>

Then when you define the endpoint:

<endpoint address="" binding="netTcpBinding" bindingConfiguration="ExStreamWCFBinding" contract="ExStreamWCF.IService1"> 

EDITED TO ADD

Baed on your additional information, assing the bindingConfiguration attribute the value “NetTcpBinding_IService1” on the endpoint in your service.

Leave a Comment