ReaderQuota的maxStringContentLength与Bindings maxReceivedMessageSize有什么区别

时间:2018-03-20 06:53:19

标签: c# wcf web-config

我有WCF服务,Bindings maxReceivedMessageSize设置为2000000,ReaderQuota的maxStringContentLength设置为128000

使用此wcf服务的客户端无法发送长度为200K(400000字节)的字符串,会引发跟随错误。

远程服务器返回了意外响应:(400)错误请求。 ---> System.Net.WebException:远程服务器返回错误:(400)Bad Request。

在System.Net.HttpWebRequest.GetResponse()

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

---内部异常堆栈跟踪结束---

我是否应该将maxStringContentLength属性增加到400000以上以便服务成功接收?

1 个答案:

答案 0 :(得分:0)

虽然尺寸maxArrayLengthm maxDepthmaxNameTableCharCountmaxStringContentLengthmaxBytesPerRead的绑定属性可能会让您失望

问题的根源似乎是 Timming Out 。您可能需要在服务/客户端配置中增加SendTimeoutReceiveTimeout属性。

你也可以看看这个类似的问题

WCF Service , how to increase the timeout?

这也是

Large Data and Streaming