今天将客户端程序引用之前创建的一个方法相当多的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服务宿主及其跨域问题解决实例** 在分布式系统开发中,Windows Communication Foundation (WCF) 是Microsoft提供的一种强大的服务导向架构,用于构建高度互操作的服务。本实例主要探讨的是如何在Silverlight...
Windows Communication Foundation(WCF)是微软.NET Framework中的一个核心组件,用于构建分布式应用程序。它提供了一种统一的方式,用于创建、部署和管理跨进程、跨网络的服务。WCF集成了多种通信技术,如Web服务...
动态配置Known Types,解决WCF动态扩展属性类型的问题: Unhandled Exception: System.Runtime.Serialization.SerializationException: Type '--------' with data contract name 'Dog:...
在.NET框架中,Windows Communication Foundation(WCF)是一种用于构建分布式应用程序的服务模型,它提供了统一的方式来进行跨进程、跨网络的通信。WCF服务可以被各种类型的客户端访问,包括WinForms应用程序。本...
微软的一个演讲PPT,描述了如何构建一个高性能的WCF解决方案
**WCF PDA开发资源:WCF Guidance For Mobile Developers** Windows Communication Foundation (WCF) 是微软推出的一种统一的编程模型,用于构建面向服务的应用程序。它允许开发者在各种平台之间进行安全、可靠、可...
**高性能的WCF解决方案** Windows Communication Foundation (WCF) 是微软提供的一种面向服务的通信框架,用于构建可互操作的、安全的、可靠的企业级应用程序。在本文中,我们将深入探讨如何优化WCF服务,以实现更...
Windows Communication Foundation(WCF)是微软.NET框架的一部分,它提供了一种统一的编程模型来创建分布式应用程序服务。WCF服务可以被多种客户端访问,包括基于Web的和传统的WCF客户端。在标题和描述中提到的...
动态配置Known Types,解决WCF动态扩展属性类型的问题: Unhandled Exception: System.Runtime.Serialization.SerializationException: Type '--------' with data contract name 'Dog:...
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 ...
<service name="WcfService1.Service1"> <add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfService1/Service1/" /> <endpoint address="" binding="basicHttpBinding" contract="Wcf...
**Windows Communication Foundation (WCF) 系列课程详解** Windows Communication Foundation(WCF)是微软.NET框架中的一个核心组件,用于构建高度可伸缩、安全和可靠的分布式应用程序。本系列课程将深入探讨WCF...
总结起来,这个“WCF客户端测试工具”是一个独立且全面的解决方案,专为测试和验证WCF服务设计。它简化了调试过程,提高了开发效率,并能在没有Visual Studio的环境中运行。文件列表中的“WcfTestClient”很可能是这...
1.文件夹SilverlightFrmWcf : winform程序托管wcf服务Silverlight调用wcf 跨域解决方案 (1)解决方案frmWcfService:winform程序托管wcf服务 (2)Silverlight项目调用wcf解决方案 2.文件夹SilverlightWCFDemo: iis...
**WCF4高级编程**是针对Windows Communication Foundation (WCF)技术的一个深入学习资源,尤其关注第四版(WCF 4)的相关特性。WCF是.NET Framework中的一个关键组件,用于构建面向服务的应用程序,它提供了统一的...
为了解决这个问题,我们需要在WCF服务端配置CORS(Cross-Origin Resource Sharing,跨源资源共享)。 **配置WCF服务支持CORS** 1. 首先,在WCF服务的配置文件(通常是`Web.config`)中,添加CORS相关的HTTP行为和...