WCF client transfers big data to server failed configuration issues

Source: Internet
Author: User
Tags xml reader

A problem has recently been encountered with WCF: When a client sends a large amount of data to a WCF service, the discovery prompts:

"The maximum string content length quota (8192) is exceeded when reading XML data. You can increase this quota by changing the Maxstringcontentlength property of the XmlDictionaryReaderQuotas object that is used when you create the XML reader. "So the internet search, are said to modify the configuration can be, but I am a beginner, modified half a day has not come out, the final various integration, try, finally succeeded, so write down, for later need: Add the following code in the configuration file (only need to modify the server configuration file):
1. Under the <system.serviceModel> node, add:

<bindings>
<basicHttpBinding>
<binding name= "NEWBINDING0"Closetimeout=" 10:10:00 "opentimeout=" 10:10:00 "receivetimeout=" 10:10:00 "sendtimeout=" 10:10:00 " Bypassproxyonlocal= "false" hostnamecomparisonmode= "StrongWildcard" maxbuffersize= "2147483647" maxBufferPoolSize= " 2147483647 "maxreceivedmessagesize=" 2147483647 "messageencoding=" Text "textencoding=" Utf-8 "transfermode=" Streamed "usedefaultwebproxy=" true ">
<readerquotas maxdepth= "2147483647" maxstringcontentlength= "2147483647" maxarraylength= "2147483647" Maxbytesperread= "2147483647" maxnametablecharcount= "2147483647"/>
<security mode= "None" >
<transport clientcredentialtype= "None" proxycredentialtype= "None" realm= ""/>
<message clientcredentialtype= "UserName" algorithmsuite= "Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>

<services>
<service behaviorconfiguration= "NewBehavior0"Name=" > "WcfService.GXSC.LoginService"
<endpoint binding= "BasicHttpBinding" contract= "WcfService.GXSC.ILoginService"/>
<baseAddresses>
<add baseaddress= "Http://localhost:1379/GXSC/LoginService.svc"/>
</baseAddresses>
</service>
<service behaviorconfiguration= "NewBehavior0"Name=" > "WcfService.GXSC.ShipInfoService"
<endpoint binding= "BasicHttpBinding" contract= "WcfService.GXSC.IShipInfoService"/>
<baseAddresses>
<add baseaddress= "Http://localhost:1379/GXSC/ShipInfoService.svc"/>
</baseAddresses>
</service>
</services>

Under the 2.<behaviors> <serviceBehaviors> node, add the following:

<behavior name= "NewBehavior0" >
<servicemetadata httpgetenabled= "true"/>
<datacontractserializer maxitemsinobjectgraph= "2147483647"/>
<servicethrottling maxconcurrentcalls= "maxconcurrentsessions=", "maxconcurrentinstances="/>
<servicedebug includeexceptiondetailinfaults= "true"/>
</behavior>

It's OK.

WCF client transfers big data to server failed configuration issues

Related Article

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.