0

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

我的服务器端配置如下:

<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) Communication Foundation 服务,请检查您是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅位于 http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata的 MSDN 文档Exchange 错误 URI:net.tcp://localhost:9081/RemWCFSvc/mex 元数据包含无法解析的引用:“net.tcp://localhost:9081/RemWCFSvc/mex”。XML 文档中存在错误。读取 XML 数据时已超出最大可命名字符计数配额 (16384)。nametable 是一种数据结构,用于存储在 XML 处理过程中遇到的字符串 - 具有不重复元素名称、属性名称和属性值的长 XML 文档可能会触发此配额。可以通过更改创建 XML 阅读器时使用的 XmlDictionaryReaderQuotas 对象的 MaxNameTableCharCount 属性来增加此配额。

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

4

1 回答 1

0

这是正确的网络配置。您需要将 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>
于 2012-11-10T04:57:14.557 回答