【问题标题】:Maximum nametable char count exceeded超出最大可命名字符数
【发布时间】:2012-10-30 08:20:49
【问题描述】:

我遇到了最大可命名字符计数配额的问题,我在这里遵循了几个答案,它解决了一段时间的问题,但现在我遇到了同样的问题。

我的服务器端配置如下:

<system.serviceModel>
      <bindings>
        <netTcpBinding>
          <binding name="GenericBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
                   maxReceivedMessageSize="2147483647">

            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            <security mode="None" />
          </binding>
        </netTcpBinding>
      </bindings>
    <behaviors>
            <serviceBehaviors>
                    <behavior>
                            <serviceMetadata httpGetEnabled="false" />
                            <serviceDebug includeExceptionDetailInFaults="true" />
                            <dataContractSerializer maxItemsInObjectGraph="1000000" />
                    </behavior>
            </serviceBehaviors>
    </behaviors>
    <services>
            <service name="REMWCF.RemWCFSvc">
              <endpoint address="" binding="netTcpBinding" contract="REMWCF.IRemWCFSvc" bindingConfiguration="GenericBinding" />
              <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
              <host>
                <baseAddresses>
                  <add baseAddress="net.tcp://localhost:9081/RemWCFSvc" />
                </baseAddresses>
              </host>
            </service>
    </services>
  </system.serviceModel>

我在 devenv 配置上也有相同的 tcp 绑定。

我是否已达到支持的合同数量上限?有没有办法关闭该配额?

编辑

错误信息:

错误:无法从 net.tcp://localhost:9081/RemWCFSvc/mex 如果这是 Windows (R) 请访问您有权访问的通信基础服务 检查您是否已在指定位置启用元数据发布 地址。有关启用元数据发布的帮助,请参阅 MSDN 文档位于 http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata交流 错误 URI:net.tcp://localhost:9081/RemWCFSvc/mex 元数据 包含无法解析的引用: 'net.tcp://localhost:9081/RemWCFSvc/mex'。有一个错误 XML 文档。最大可命名字符数配额 (16384) 读取 XML 数据时已超出。命名表是一个数据 用于存储 XML 处理过程中遇到的字符串的结构 - 具有不重复元素名称、属性名称的长 XML 文档 和属性值可能会触发此配额。这个配额可能是 通过更改 MaxNameTableCharCount 属性增加 创建 XML 阅读器时使用的 XmlDictionaryReaderQuotas 对象。

我在尝试运行 WCF(托管在 Windows 服务应用程序中)时遇到该错误。

【问题讨论】:

  • 据我所知,邮件的大小没有限制。正确配置有时相当棘手。您收到什么错误消息?
  • 我用错误更新了问题。
  • 我已经编辑了你的标题。请参阅“Should questions include “tags” in their titles?”,其中的共识是“不,他们不应该”。

标签: .net wcf wcf-binding


【解决方案1】:

这是正确的网络配置。您需要将 metadataenabled 设置为 true,并且您还没有定义行为名称。试试这个配置。

<system.serviceModel>
      <bindings>
        <netTcpBinding>
          <binding name="GenericBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
                   maxReceivedMessageSize="2147483647">

            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            <security mode="None" />
          </binding>
        </netTcpBinding>
      </bindings>
  <behaviors>
    <serviceBehaviors>
      <behavior name="SilverlightWCFLargeDataApplication">
        <serviceMetadata httpGetEnabled="true"/>
        <serviceDebug includeExceptionDetailInFaults="false"/>
        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      </behavior>

    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="SilverlightWCFLargeDataApplication">
        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
    <services>
            <service name="REMWCF.RemWCFSvc" behaviorConfiguration="SilverlightWCFLargeDataApplication">
              <endpoint address="" behaviorConfiguration="SilverlightWCFLargeDataApplication" binding="netTcpBinding" contract="REMWCF.IRemWCFSvc" bindingConfiguration="GenericBinding" />
                <host>
                <baseAddresses>
                  <add baseAddress="net.tcp://localhost:9081/RemWCFSvc" />
                </baseAddresses>
              </host>
            </service>
    </services>
  </system.serviceModel>

【讨论】:

    猜你喜欢
    • 2013-08-16
    • 2011-01-30
    • 1970-01-01
    • 2011-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-28
    相关资源
    最近更新 更多