Setting maxitemsinobjectgraph for WCF

Source: Internet
Author: User

Most of the issues discussed on the Internet about how to transmit a large amount of data through WCF are maxcompute edmessagesize = "2147483647" maxbufferpoolsize = "2147483647" maxbuffersize = "2147483647 ".

I have also set these settings, but when I debug WCF today, when I use an account to perform all operations OK. However, an error is reported when I use another account.

"The maximum number of projects in the object graph that can be serialized or deserialized is" 65536 ". Please change the object graph or increase the maxitemsinobjectgraph quota ".

Finally, I checked the database and found that there were only a few hundred data records in the previous account, and there were more than data records in the other account, which must have exploded.


Next, if you set maxitemsinobjectgraph on the server and client

WCF server configuration file

<system.serviceModel>    <services>      <service behaviorConfiguration="BasicServiceBehavior" name="XXX.WCF.Product">        <endpoint address="" binding="customBinding" bindingConfiguration="CompressionChannel" contract="XXX.WCF.IProduct">          <identity>            <dns value="localhost"/>          </identity>        </endpoint>        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>      </service>    </services>    <extensions>      <bindingElementExtensions>        <add          type="WcfExtensions.ServiceModel.Configuration.CompressionElement,WcfExtensions.ServiceModel"          name="compression"/>      </bindingElementExtensions>    </extensions>    <bindings>      <customBinding>        <binding name="CompressionChannel"  receiveTimeout="01:00:00" sendTimeout="01:00:00" >          <compression/>          <textMessageEncoding>            <readerQuotas maxDepth="1024"                          maxStringContentLength="2147483647"                          maxArrayLength="2147483647"                          maxBytesPerRead="2147483647" />          </textMessageEncoding>          

Client configuration file

<system.serviceModel>    <extensions>      <bindingElementExtensions>        <add          type="WcfExtensions.ServiceModel.Configuration.CompressionElement,WcfExtensions.ServiceModel"          name="compression"/>      </bindingElementExtensions>    </extensions>    <bindings>      <customBinding>        <binding name="CompressionChannel" >          <compression/>          <textMessageEncoding>            <readerQuotas maxDepth="32"                          maxStringContentLength="2147483647"                          maxArrayLength="2147483647"                          maxBytesPerRead="2147483647"/>          </textMessageEncoding>          

In this way, you can increase the maximum transmission Volume After configuring the server and client.

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.