`
markgoo
  • 浏览: 8355 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

解决WCF The maximum nametable character count quota (16384) has been exceeded whil

    博客分类:
  • wcf
WCF 
阅读更多

今天将客户端程序引用之前创建的一个方法相当多的services的时候碰到如下一个错误,

 

Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:9997/DataService/mex'.
There is an error in the XML document.
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.
If the service is defined in the current solution, try building the solution and adding the service reference again.
 

当前的endpoint配置

<service behaviorConfiguration="MyBehavior" name="XXX.XXXX.DataService">
       <endpoint address="" binding="netTcpBinding" name="NetTcpEndPoint" contract="XXX.XXXX.XXXXXXX.XXXX.XXXXXXXXXXXXXX.IDataService"/>
       <endpoint address="mex" binding="mexTcpBinding" name="NetTcpMetadataPoint" contract="IMetadataExchange"/>
       <host>
        <baseAddresses>
         <add baseAddress="net.tcp://localhost:9997/DataService/"/>
        </baseAddresses>
       </host>
      </service>
 

 

解决办法:

1.在service的app.config的<system.serviceModel>节电下创建一个新的bindings, 使用netTcpBinding来代替mexTcpBinding:

<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>
 

 

2.将之前的endpoint设置改成

<service behaviorConfiguration="MyBehavior" name="XXX.XXXX.DataService">
       <endpoint address="" binding="netTcpBinding" name="NetTcpEndPoint" bindingConfiguration="GenericBinding" contract="XXX.XXXX.XXXXXXX.XXXX.XXXXXXXXXXXXXX.IDataService"/>
       <endpoint address="mex" binding="netTcpBinding" name="NetTcpMetadataPoint" bindingConfiguration="GenericBinding" contract="IMetadataExchange"/>
       <host>
        <baseAddresses>
         <add baseAddress="net.tcp://localhost:9997/DataService/"/>
        </baseAddresses>
       </host>
      </service>
 

 

3.修改Client端的app.config 或者在"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE" 下的devenv.exe.config(修改这个的话需要重启VS)中添加.

添加

<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>
    <client>
      <endpoint binding="netTcpBinding" bindingConfiguration="GenericBinding"
        contract="IMetadataExchange" name="net.tcp" />
    </client>
  </system.serviceModel>
 

 

4.之后再重新Add Service References就正常了.

 

我的原文连接 http://www.markgoo.com/?p=73


分享到:
评论

相关推荐

    WCF服务宿主及其跨域问题解决实例

    **WCF服务宿主及其跨域问题解决实例** 在分布式系统开发中,Windows Communication Foundation (WCF) 是Microsoft提供的一种强大的服务导向架构,用于构建高度互操作的服务。本实例主要探讨的是如何在Silverlight...

    WCF

    Windows Communication Foundation(WCF)是微软.NET Framework中的一个核心组件,用于构建分布式应用程序。它提供了一种统一的方式,用于创建、部署和管理跨进程、跨网络的服务。WCF集成了多种通信技术,如Web服务...

    wcf经典实例wcf经典实例wcf经典实例

    wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例

    WCF中动态设置KnownType的示例代码

    动态配置Known Types,解决WCF动态扩展属性类型的问题: Unhandled Exception: System.Runtime.Serialization.SerializationException: Type '--------' with data contract name 'Dog:...

    WCF教程WCF教程

    **Windows Communication Foundation (WCF) 教程** Windows Communication Foundation(WCF)是微软.NET框架中的一个核心组件,用于构建可互操作的分布式系统。它为开发者提供了一种统一的方式来创建、部署和管理...

    WCF宿主程序WCF宿主程序

    **WCF(Windows Communication Foundation)**是微软.NET框架下的一个组件,它提供了一种用于构建分布式应用程序的强大且灵活的服务模型。WCF旨在统一各种通信协议和编程模型,使得跨网络、进程甚至计算机的通信变得...

    wcf服务 winform宿主 客户端请求wcf 示例

    在.NET框架中,Windows Communication Foundation(WCF)是一种用于构建分布式应用程序的服务模型,它提供了统一的方式来进行跨进程、跨网络的通信。WCF服务可以被各种类型的客户端访问,包括WinForms应用程序。本...

    设计高性能的WCF解决方案

    微软的一个演讲PPT,描述了如何构建一个高性能的WCF解决方案

    WCF PDA开发资源 WCF Guidance For Mobile Developers

    **WCF PDA开发资源:WCF Guidance For Mobile Developers** Windows Communication Foundation (WCF) 是微软推出的一种统一的编程模型,用于构建面向服务的应用程序。它允许开发者在各种平台之间进行安全、可靠、可...

    高性能的WCF解决方案

    **高性能的WCF解决方案** Windows Communication Foundation (WCF) 是微软提供的一种面向服务的通信框架,用于构建可互操作的、安全的、可靠的企业级应用程序。在本文中,我们将深入探讨如何优化WCF服务,以实现更...

    WCFService可以通过web调用和WCF服务访问

    Windows Communication Foundation(WCF)是微软.NET框架的一部分,它提供了一种统一的编程模型来创建分布式应用程序服务。WCF服务可以被多种客户端访问,包括基于Web的和传统的WCF客户端。在标题和描述中提到的...

    WCF中动态设置KnownType的示例

    动态配置Known Types,解决WCF动态扩展属性类型的问题: Unhandled Exception: System.Runtime.Serialization.SerializationException: Type '--------' with data contract name 'Dog:...

    WCF & WPF 聊天程序源码

    To be honest the original article was pure brilliance (it should be mentioned Nikola is a Professor), but it took a while for me to get what was going on, as the code wasn't commented. I have now ...

    wcf 代理 wcf开发示例

    &lt;service name="WcfService1.Service1"&gt; &lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfService1/Service1/" /&gt; &lt;endpoint address="" binding="basicHttpBinding" contract="Wcf...

    WCF系列课程 webcast

    **Windows Communication Foundation (WCF) 系列课程详解** Windows Communication Foundation(WCF)是微软.NET框架中的一个核心组件,用于构建高度可伸缩、安全和可靠的分布式应用程序。本系列课程将深入探讨WCF...

    WCF客户端测试工具,亲测可用

    总结起来,这个“WCF客户端测试工具”是一个独立且全面的解决方案,专为测试和验证WCF服务设计。它简化了调试过程,提高了开发效率,并能在没有Visual Studio的环境中运行。文件列表中的“WcfTestClient”很可能是这...

Global site tag (gtag.js) - Google Analytics