I\'m trying to pass a large string (24,000 to 50,000 characters) to a self-hosted TCP WCF service.
I\'ve upped the maxStringContentLength (everywhere) to 22008192.
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:
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.
Sometimes changing "maxStringContentLength" value to maximum may not help.hence Add the below "default" binding inside the "basicHttpBinding" section in server config file.
<binding >
<readerQuotas maxDepth="32" maxStringContentLength="102400" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>