WCF the remote server returned an error: (400) Bad request

Source: Internet
Author: User

This error does not occur if a small amount of data is used to call the WCF Service, but is returned if a large amount of data is used. It took several hours to know that the WCF Service layer also needs the bindingconfiguration attribute to modify the Web. config of the service layer.
Web. config
============
<Services>
<Service name = "doccube. businesslogic. documentmanager"
Behaviorconfiguration = "httpgetbehavior">
<Endpoint binding = "wshttpbinding" bindingconfiguration = "wshttp"
Contract = "doccube. Interfaces. idocumentmanager"
Address = ""/>
</Service>
</Services>

Note: manually add the "bindingconfiguration" attribute. vsplatform does not automatically generate this attribute. The configuration associated with bindingconfiguration is as follows:

<Bindings>
<Wshttpbinding>
<Binding name = "wshttp" maxcompute edmessagesize = "9999999"
Messageencoding = "MTOM" maxbufferpoolsize = "9999999">
& Lt; readerquotas maxdepth = "9999999"
Maxarraylength = "9999999" maxbytesperread = "9999999"
Maxnametablecharcount = "9999999" maxstringcontentlength = "9999999"/>
<Security mode = "NONE"/>
</Binding>
</Wshttpbinding>
</Bindings>

Then. delete the config file and re-obtain the service reference at the service layer. Note that the binding protocols referenced by the client and server must be the same, for example, the app of the client. the value of binding referenced by config, maxcompute edmessagesize is equal to 9999999, so the service layer must have the same configuration, and this value is also 9999999.

 

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.