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