There are many WCF service interfaces, and the client has an error referencing it! Reported WCF the maximum NameTable character count quota (16384) have been exceeded while reading XML data error

Source: Internet
Author: User
Tags xml reader

Original: WCF service interface is many, client error in reference! Reported WCF the maximum NameTable character count quota (16384) have been exceeded while reading XML data error

When you define an interface too much on the server, the client's service reference is reported as an error:

The metadata contains a reference that cannot be resolved: "Net.tcp://localhost:8081/basedata/mex".    There is an error in the XML document. When reading XML data, the maximum name table character count quota (16384) is exceeded. A name table is a data structure used to store strings that are encountered when processing XML-long XML documents with distinct elements, attribute names, and property values may trigger this quota. You can increase this quota by changing the Maxnametablecharcount property of the XmlDictionaryReaderQuotas object that is used when you create the XML reader.

Workaround:

Server-side configuration file:

<system.serviceModel>    <services>      <!--basic Data Services-->      <service name= "Pmswcfserver.pmswcfbasedata" behaviorconfiguration= "Wcfbasedata" >       

<!--Note: In the red font, you must modify the Maxnametablecharcount value to increase the quota--

<readerquotas maxnametablecharcount= "2147483647" maxstringcontentlength= "2147483647" maxBytesPerRead= "214 7483647 "maxarraylength=" 2147483647 "maxdepth=" 32000 "/></binding> </netTcpBinding> </bindings> </system.serviceModel>

Just modify the above configuration file, the client still after the reference is unsuccessful, also need to modify: C:\Program Files\Microsoft Visual Studio 10.0\common7\ide\ Devenv.exe.Config file, add the following sections after the file:

<system.serviceModel> <bindings> <netTcpBinding> <binding name= "Bindsystem"maxbufferpoolsize= "2147483647"maxbuffersize= "2147483647" maxreceivedmessagesize= "2147483647" ><readerquotas maxdepth= "2147483647" maxstringcontentlength= "2147483647 "maxarraylength= "2147483647" maxbytesperread= "2147483647" maxnametablecharcount= " 2147483647"/><security mode= "None"/> </binding> </netTcpBinding> </bindings> <cli ent> <endpoint binding= "nettcpbinding" bindingconfiguration= "Bindsystem"Contract=" IMetadataExchange "name=" net.tcp "/> </client>

</system.serviceModel>

Restart VS, and then reference success again!

There are many WCF service interfaces, and the client has an error referencing it! Reported WCF the maximum NameTable character count quota (16384) have been exceeded while reading XML data error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.