问题描述
我有一个使用的wsHttpBinding WCF服务。服务器配置如下:
<&绑定GT;
<&的wsHttpBinding GT;
<绑定名称=的wsHttpBindingmaxBufferPoolSize =2147483647
maxReceivedMessageSize =2147483647>
< readerQuotas MAXDEPTH =2147483647maxStringContentLength =2147483647
maxArrayLength =2147483647maxBytesPerRead =2147483647maxNameTableCharCount =2147483647/>
<安全模式=无>
<运输clientCredentialType =视窗proxyCredentialType =无
境界=/>
<消息clientCredentialType =视窗negotiateServiceCredential =真正的
algorithmSuite =默认establishSecurityContext =真/>
< /安全>
< /&结合GT;
< /&的wsHttpBinding GT;
< /绑定>
在客户端,我包括WCF的服务的服务引用。它的伟大工程,如果我有限的功能,说90经营合同在我IService,但如果增加一个OperationContract的比我无法更新服务的参考,也没有我能添加服务引用。在文章它提到,通过改变这些配置文件(即devenv.exe.config,WcfTestClient.exe.config和SvcUtil.exe.config),它会工作,但即使包括那些配置文件仍是错误弹出说这些绑定
有一个错误下载'http://10.0.3.112/MyService/Service1.svc/mex。
请求失败,HTTP状态400:错误的请求。
元数据包含无法解析的引用:http://10.0.3.112/MyService/Service1.svc/mex。
有XML文档(1,89549)错误。读取XML数据
的最大nametable字符计数配额(16384)已超出。该nametable是用于XML处理过程中遇到的存储字符串的数据结构 - 长XML文档与非重复元素名称,属性名称和属性值可能会触发此配额。这种配额可能会增加通过更改XmlDictionaryReaderQuotas的MaxNameTableCharCount属性创建XML阅读器时,对象使用。 1号线,位置89549.
如果该服务在当前的解决方案定义,尝试构建解决方案,并再次添加服务引用。
不知道如何解决这个????
请尝试以下操作:
在devenv.exe的所在(例如C:\Program Files\Microsoft的Visual Studio 9.0\Common7\IDE)的Visual Studio安装目录这一节加入到devenv.exe.cofig
< system.serviceModel>
<客户端>
<端点绑定=customBindingbindingConfiguration =largeServiceBinding合同=IMetadataExchange接口NAME =HTTP/>
< /客户>
<&绑定GT;
< customBinding>
< - !注:在WCF服务的配置文件中指定的绑定名称必须是相同的 - >
<绑定名称=largeServiceBinding>
< textMessageEncoding>
< readerQuotas MAXDEPTH =2147483647maxStringContentLength =2147483647maxArrayLength =2147483647maxBytesPerRead =2147483647maxNameTableCharCount =2147483647/>
< / textMessageEncoding>
< httpTransport transferMode =缓冲maxReceivedMessageSize =2147483647MAXBUFFERSIZE =2147483647/>
< /&结合GT;
< / customBinding>
< /绑定>
< /system.serviceModel>
在您的WCF服务的app.config中添加相同的绑定:
<&绑定GT;
< customBinding>
< - !注:如在位于VS安装目录下的文件夹..\Common7\IDE的devenv.exe.config文件中指定的绑定名称必须是相同的 - >
<绑定名称=largeServiceBinding>
< textMessageEncoding>
< readerQuotas MAXDEPTH =2147483647maxStringContentLength =2147483647maxArrayLength =2147483647maxBytesPerRead =2147483647
maxNameTableCharCount =2147483647/>
< / textMessageEncoding>
< httpTransport transferMode =缓冲maxReceivedMessageSize =2147483647MAXBUFFERSIZE =2147483647/>
< /&结合GT;
< / customBinding>
< /绑定>
注意:从两个文件的装订标签的name属性必须匹配(如largeServiceBinding)
最后添加以下MEX端点到您的服务标签:
<端点地址=MEX绑定=customBinding合同=IMetadataExchange接口bindingName =testBindingbindingConfiguration =largeServiceBindingNAME = HTTP/>
这可能是这样的:
<服务和GT;
<服务behaviorConfiguration =MyServiceBehavior
NAME =MyService.MyService>
<端点地址=绑定=的wsHttpBinding合同=MyService.IMyService>
<同一性GT;
< DNS值=本地主机/>
< /身份>
< /端点>
<端点地址=MEX绑定=customBinding合同=IMetadataExchange接口bindingName =testBindingbindingConfiguration =largeServiceBindingNAME =HTTP/>
<主机>
< baseAddresses>
<添加baseAddress =HTTP://本地主机:8731 / Design_Time_Addresses /为MyService /为MyService //>
< / baseAddresses>
< /主机>
< /服务>
< /服务>
I'm having a WCF Service that uses wsHttpBinding. The server configuration is as follows :
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
At the client side I'm including the Service reference of the WCF-Service. It works great if I have limited functions say 90 Operation Contract in my IService but if add one more OperationContract than I'm unable to Update the Service reference nor i'm able to add that service reference. In this article it's mentioned that by changing those config files(i.e devenv.exe.config, WcfTestClient.exe.config and SvcUtil.exe.config) it will work but even including those bindings in those config files still that error pops up saying
There was an error downloading 'http://10.0.3.112/MyService/Service1.svc/mex'.The request failed with HTTP status 400: Bad Request.Metadata contains a reference that cannot be resolved: 'http://10.0.3.112/MyService/Service1.svc/mex'.There is an error in XML document (1, 89549).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. Line 1, position 89549.If the service is defined in the current solution, try building the solution and adding the service reference again.
Any idea how to solve this????
Try the following:
In the installation directory of your Visual Studio where devenv.exe is located (e.g. C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE) add this section to the devenv.exe.cofig
<system.serviceModel>
<client>
<endpoint binding="customBinding" bindingConfiguration="largeServiceBinding" contract="IMetadataExchange" name="http" />
</client>
<bindings>
<customBinding>
<!-- NOTE: The binding name must be the same as specified in the config file of the wcf service -->
<binding name="largeServiceBinding" >
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport transferMode="Buffered" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
</system.serviceModel>
in the app.config of your WCF-service add the same binding:
<bindings>
<customBinding >
<!-- NOTE: The binding name must be the same as specified in the devenv.exe.config file located ..\Common7\IDE folder of the VS installation directory -->
<binding name="largeServiceBinding" >
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport transferMode="Buffered" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
Note that the name attribute of the binding tags from the two files must match (e.g. largeServiceBinding)
Finally add the following mex endpoint into your service tag:
<endpoint address="mex" binding="customBinding" contract="IMetadataExchange" bindingName="testBinding" bindingConfiguration="largeServiceBinding" name="http"/>
this may look like this:
<services>
<service behaviorConfiguration="MyServiceBehavior"
name="MyService.MyService">
<endpoint address="" binding="wsHttpBinding" contract="MyService.IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="customBinding" contract="IMetadataExchange" bindingName="testBinding" bindingConfiguration="largeServiceBinding" name="http"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/MyService/MyService/" />
</baseAddresses>
</host>
</service>
</services>
这篇关于WCF - 最大nametable字符计数配额(16384)读取XML数据已经超过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!