exception Information : The maximum string content length quota (8192) have been exceeded while reading XML data
Issue : Invoking a third-party WCF service that produces the above exception information
Analysis:
When publishing the WCF host side, make sure that the host side and client settings allow for a certain size of data transfer.
If the transfer size is not set, the maxstringcontentlength default size is 8192.
1) If the third-party service is not set maxstringcontentlength or the maxstringcontentlength is less than the transfer information that we call the third-party WCF service to return, the above exception is generated.
In this case, we can contact the third party to set the value of the maxstringcontentlength a bit larger.
2) This exception is also generated if the caller does not set maxstringcontentlength or if the maxstringcontentlength is less than the transfer information returned by the WCF service that we invoke.
In this case, just change the maxstringcontentlength to the appropriate size in our configuration file.
Solution:
First, determine whether it is a client or host-side limitation. If it is a client-side limitation, modify it on the client, if it is a limitation of the host (own project or third party), modify it on the host side.
Then, modify the configuration file:
<bindingname= "Bindingconfiguration value corresponding to service endpoint node"Opentimeout= "00:05:00"ReceiveTimeout= "00:05:00"Sendtimeout= "00:05:00"allowcookies= "false"bypassproxyonlocal= "false"HostNameComparisonMode= "StrongWildcard"maxBufferSize= "655360000"maxbufferpoolsize= "5242880000"MaxReceivedMessageSize= "655360000"messageencoding= "Text"textencoding= "Utf-8"Transfermode= "Buffered"Usedefaultwebproxy= "true"><ReaderquotasmaxDepth= " the"Maxstringcontentlength= "655360000"Maxarraylength= "163840"Maxbytesperread= "40960"Maxnametablecharcount= "163840" /><SecurityMode= "None"><TransportclientCredentialType= "None"Proxycredentialtype= "None"Realm="" /><messageclientCredentialType= "UserName"Algorithmsuite= "Default" /></Security></binding>
Code:maxstringcontentlength= "655360000", which needs to be set according to the length of the information transmitted by the WCF service.
WCF common exceptions-the maximum string content length quota (8192) have been exceeded while reading XML data