【发布时间】:2013-09-25 07:27:18
【问题描述】:
我们在项目的 WCF 中使用 NetTCPbinding。最近,随着服务操作数量增加到超过 75 个,我们在启动服务时遇到了这个错误。
XML 文档中存在错误。
读取 XML 数据时已超出最大可命名字符计数配额 (16384)。 nametable 是一种数据结构,用于存储在 XML 处理过程中遇到的字符串 - 具有不重复元素名称、属性名称和属性值的长 XML 文档可能会触发此配额。可以通过更改创建 XML 阅读器时使用的 XmlDictionaryReaderQuotas 对象的 MaxNameTableCharCount 属性来增加此配额。
正如此错误消息中所建议的,我们增加了 MaxNameTableCharCount 属性的配额,但这并没有解决我们的问题。
我们的团队也遵循了以下链接中提供的解决方案。但是,这些都不适合我们。
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
请在下面找到我们的服务器端 app.config
<?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>
在这种情况下,我们将不胜感激任何帮助。如果您需要更多信息,请告诉我。谢谢。
【问题讨论】:
-
您是否也将该自定义
netTcpBinding配置应用到您的客户端 WCF 代码?? -
在开发过程中,服务由 WCF 测试客户端/svcutil 启动。因此,目前只有我们面临这个问题。在客户端添加这些配额没有帮助。服务未启动。
标签: wcf