1

We are using NetTCPbinding in WCF in our project. Recently, as the number of service operations increased beyond 75, we are facing this error while starting our service.

There is an error in the XML document.
The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader.

As suggested in this error message, we have increased the quota on MaxNameTableCharCount property, but it is not solving our issue.

Our team have also followed the solutions given in the links below. But, none of these is working for us.

WCF - The maximum nametable character count quota (16384) has been exceeded while reading XML data

http://geekswithblogs.net/claraoscura/archive/2007/08/20/114806.aspx

http://mnairooz.blogspot.in/2010/06/maximum-nametable-character-count-quota.html

Please find below our app.config on server side

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="Test.ServiceLibraryHost.ServiceBehavior"
               name="Test.ServiceLibraryHost.TestService">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="myNetTcpBinding" contract="Test.ServiceLibraryHost.ITestService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8529/TestService"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Test.ServiceLibraryHost.ServiceBehavior">
          <serviceMetadata />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="myNetTcpBinding">
          <readerQuotas maxDepth="32" maxStringContentLength="21745878" maxArrayLength="21745878"
              maxBytesPerRead="21745878" maxNameTableCharCount="21745878" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Any help, in this case, would be highly appreciated. Let me know in case you need any more information. Thank you.

Community
  • 1
  • 1
DareToExplore
  • 249
  • 4
  • 15
  • Have you **also** applied that custom `netTcpBinding` configuration to your **client-side** WCF code?? – marc_s Sep 25 '13 at 09:05
  • while developing, the service is started by the WCF test client/svcutil. Hence, it is at this point only we are facing this issue. Adding these quotas, on client side is not helping. The service is not starting up. – DareToExplore Sep 25 '13 at 09:31

2 Answers2

3

Finally got the issue resolved !!!!

We consulted the technical architect. After trying out many ways, what we found that if we install the .Net framework 4.5 version (Our application uses .Net framework 4.0), this issue got automatically resolved without making any changes to the config file on server-side.

If anyone still faces this issue after instaling the .Net framework 4.5, he/she can increase the 'maxNameTableCharCount' value in the reader's quota tag.

There may be some fix regarding this in the new framework version.

I hope that helps somebody, when no other solution avaliable works.

Let me know in case you need any further information.

Thanks.

DareToExplore
  • 249
  • 4
  • 15
1

You have to use the same readerQuotas on the client and server:

 <readerQuotas maxDepth="32" maxStringContentLength="21745878" maxArrayLength="21745878"
          maxBytesPerRead="21745878" maxNameTableCharCount="21745878" />

Check if the are the same on both sides, I guess you did not change the quota's on the client side.

Peter
  • 27,590
  • 8
  • 64
  • 84
  • while developing, the service is started by the WCF test client/svcutil. Hence, it is at this point only we are facing this issue. Adding these quotas, on client side is not helping. The service is not starting up. – DareToExplore Sep 25 '13 at 09:31
  • 1
    If the service is not starting up you have an other problem, it is not the quota's. – Peter Sep 25 '13 at 09:33
  • But, when we try to run the service, then it is showing the quota error only. We tried to use the http binding, instead of netTcp and the service started up successfully. – DareToExplore Sep 25 '13 at 10:47