0

I have WCF service with Bindings maxReceivedMessageSize set to 2000000 and ReaderQuota's maxStringContentLength set to 128000

Client which is using this wcf service unable to send string of length 200K (400000 bytes), it throws following error.

The remote server returned an unexpected response: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.

at System.Net.HttpWebRequest.GetResponse()

at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

--- End of inner exception stack trace ---

Should I increase the maxStringContentLength property to greater than 400000 to successfuly received by service?

  • See this answer explaining what maxStringContentLength represents: https://stackoverflow.com/a/36931852/5311735 – Evk Mar 20 '18 at 07:26

1 Answers1

0

Although the binding properties for sizes maxArrayLengthm maxDepth, maxNameTableCharCount, maxStringContentLength, maxBytesPerRead may trip you up

It seems the root of your problem is the request is Timming Out. You probably need to increase SendTimeout and ReceiveTimeout properties in the service/client configurations.

You could probably also look at this similar question

WCF Service , how to increase the timeout?

And this as well

Large Data and Streaming

TheGeneral
  • 79,002
  • 9
  • 103
  • 141