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>:
- <System. serviceModel>
- <Bindings>
- <BasicHttpBinding>
- <Binding name = "BasicHttpBinding_USService1" closeTimeout = "00:03:00"
- OpenTimeout = "00:03:00" receiveTimeout = "00:10:00" sendTimeout = "00:03:00"
- AllowCookies = "false" bypassProxyOnLocal = "false" hostNameComparisonMode = "StrongWildcard"
- MaxBufferSize = "2147483647" maxBufferPoolSize = "2147483647" maxcompute edmessagesize = "2147483647"
- MessageEncoding = "Text" textEncoding = "UTF-8" transferMode = "Buffered"
- UseDefaultWebProxy = "true">
- <ReaderQuotas maxDepth = "32" 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>
- <Client>
- <Endpoint address = "http: // localhost: 8001/usinfoservices" binding = "basicHttpBinding"
- BindingConfiguration = "BasicHttpBinding_USService1" contract = "ServiceReference2.USService"
- Name = "BasicHttpBinding_USService1"/>
- </Client>
- </System. serviceModel>
- Then, modify the <Hosting> configuration file on the server:
- 1. Modify the maximum data transfer quota on the node <binding>:
- <System. serviceModel>
- <Bindings>
- <BasicHttpBinding>
- <Binding name = "newBinding" maxBufferPoolSize = "21474835647" maxcompute edmessagesize = "2147483647" messageEncoding = "Text">
- <ReaderQuotas maxDepth = "2147483647" maxStringContentLength = "2147483647" maxArrayLength = "2147483647" maxBytesPerRead = "2147483647" maxNameTableCharCount = "2147483647"/>
- </Binding>
- </BasicHttpBinding>
- </Bindings>
- <Behaviors>
- <ServiceBehaviors>
- <Behavior name = "metadataBehavior">
- <ServiceMetadata httpGetEnabled = "true"/>
- <ServiceDebug includeExceptionDetailInFaults = "true"/>
- </Behavior>
- </ServiceBehaviors>
- </Behaviors>
- <Services>
- <Service behaviorConfiguration = "metadataBehavior" name = "Genesysinfo. USServices. Services. USInfoServices">
- <Endpoint address = "" bindingConfiguration = "newBinding" binding = "basicHttpBinding" contract = "Genesysinfo. USServices. Contracts. IUSInfoServices"/>
- <Endpoint address = "" binding = "netTcpBinding" contract = "Genesysinfo. USServices. Contracts. IUSInfoServices"/>
- <Host>
- <BaseAddresses>
- <Add baseAddress = "http: // localhost: 8001/usinfoservices"/>
- <Add baseAddress = "net. tcp: // localhost: 8000/usinfoservices"/>
- </BaseAddresses>
- </Host>
- <Endpoint address = "mex" binding = "mexTcpBinding" contract = "IMetadataExchange"/>
- </Service>
- </Services>
- </System. serviceModel>
Copy code
OK.