The remote server returns an unexpected 400 Bad Request.

Source: Internet
Author: User

This article from: http://bbs.51aspx.com/showtopic-42348.html

 

The remote server returns an unexpected 400 Bad Request. The reason is: the amount of data transmitted is too large.
Solution:
First, in the client configuration file:
1. Modify the maximum data transfer quota on the node <binding>:

  1. <System. serviceModel>
  2. <Bindings>
  3. <BasicHttpBinding>
  4. <Binding name = "BasicHttpBinding_USService1" closeTimeout = "00:03:00"
  5. OpenTimeout = "00:03:00" receiveTimeout = "00:10:00" sendTimeout = "00:03:00"
  6. AllowCookies = "false" bypassProxyOnLocal = "false" hostNameComparisonMode = "StrongWildcard"
  7. MaxBufferSize = "2147483647" maxBufferPoolSize = "2147483647" maxcompute edmessagesize = "2147483647"
  8. MessageEncoding = "Text" textEncoding = "UTF-8" transferMode = "Buffered"
  9. UseDefaultWebProxy = "true">
  10. <ReaderQuotas maxDepth = "32" maxStringContentLength = "2147483647"
  11. MaxArrayLength = "2147483647" maxBytesPerRead = "2147483647" maxNameTableCharCount = "2147483647"/>
  12. <Security mode = "None">
  13. <Transport clientCredentialType = "None" proxyCredentialType = "None"
  14. Realm = ""/>
  15. <Message clientCredentialType = "UserName" algorithmSuite = "Default"/>
  16. </Security>
  17. </Binding>
  18. </BasicHttpBinding>
  19. </Bindings>
  20. <Client>
  21. <Endpoint address = "http: // localhost: 8001/usinfoservices" binding = "basicHttpBinding"
  22. BindingConfiguration = "BasicHttpBinding_USService1" contract = "ServiceReference2.USService"
  23. Name = "BasicHttpBinding_USService1"/>
  24. </Client>
  25. </System. serviceModel>
  26. Then, modify the <Hosting> configuration file on the server:
  27. 1. Modify the maximum data transfer quota on the node <binding>:
  28. <System. serviceModel>
  29. <Bindings>
  30. <BasicHttpBinding>
  31. <Binding name = "newBinding" maxBufferPoolSize = "21474835647" maxcompute edmessagesize = "2147483647" messageEncoding = "Text">
  32. <ReaderQuotas maxDepth = "2147483647" maxStringContentLength = "2147483647" maxArrayLength = "2147483647" maxBytesPerRead = "2147483647" maxNameTableCharCount = "2147483647"/>
  33. </Binding>
  34. </BasicHttpBinding>
  35. </Bindings>
  36. <Behaviors>
  37. <ServiceBehaviors>
  38. <Behavior name = "metadataBehavior">
  39. <ServiceMetadata httpGetEnabled = "true"/>
  40. <ServiceDebug includeExceptionDetailInFaults = "true"/>
  41. </Behavior>
  42. </ServiceBehaviors>
  43. </Behaviors>
  44. <Services>
  45. <Service behaviorConfiguration = "metadataBehavior" name = "Genesysinfo. USServices. Services. USInfoServices">
  46. <Endpoint address = "" bindingConfiguration = "newBinding" binding = "basicHttpBinding" contract = "Genesysinfo. USServices. Contracts. IUSInfoServices"/>
  47. <Endpoint address = "" binding = "netTcpBinding" contract = "Genesysinfo. USServices. Contracts. IUSInfoServices"/>
  48. <Host>
  49. <BaseAddresses>
  50. <Add baseAddress = "http: // localhost: 8001/usinfoservices"/>
  51. <Add baseAddress = "net. tcp: // localhost: 8000/usinfoservices"/>
  52. </BaseAddresses>
  53. </Host>
  54. <Endpoint address = "mex" binding = "mexTcpBinding" contract = "IMetadataExchange"/>
  55. </Service>
  56. </Services>
  57. </System. serviceModel>

Copy code

OK.

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.