How to send large Messages to the WCF Services?
I have one DataContract in the WCF service.In that it has one Array and i am setting that array in the Client code. If I set the array to more than 1000 thousand its throwing up an error saying BadRequest. System.开发者_如何学运维ServiceModel.ProtocolException : The Remote server returned an unexpected response (400) Bad Request.
How to overcome this? I want to send more data to the service.
You can try to increase the size allowed for a message. You'll need to set both the service and the client endpoint to use the binding configuration.
<bindings>
<netTcpBinding>
<binding name="TcpBindingConfiguration" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
If the data you are trying to send cannot fit within the message size allowed by the above configuration, you'll need to look into ways to either send less data or do it in multiple requests.
You can see this question for related information.
精彩评论