WCF common exceptions-the maximum string content length quota (8192) have been exceeded while reading XML data

Source: Internet
Author: User

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

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.