DareToExplore
DareToExplore

Reputation: 259

The maximum nametable character count quota (16384) has been exceeded while reading XML data error when number of service operations exceed 75

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.

Upvotes: 1

Views: 4211

Answers (2)

DareToExplore
DareToExplore

Reputation: 259

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.

Upvotes: 3

Peter
Peter

Reputation: 27944

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.

Upvotes: 1

Related Questions