WCF webservice:发送大量输入时HTTP / 1.1 400 Bad Request(WCF webservice: HTTP/1.1 400 Bad Request while send

编程入门 行业动态 更新时间:2024-10-24 23:31:11
WCF webservice:发送大量输入时HTTP / 1.1 400 Bad Request(WCF webservice: HTTP/1.1 400 Bad Request while sending large input)

我正在连接到基于WCF的Web服务。 对于某些方法,输入包含对象/结构的列表。 当此列表中的项目数增加超过一定数量时,当我尝试使用SOAPUI测试相同时,服务将失败并显示HTTP/1.1 400 Bad Request 。 我尝试使用以下更改来更改web.config文件:

<httpRuntime maxRequestLength="2097151" /> <binding name="basicHTTP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" maxReceivedMessageSize="4194304" maxBufferSize="98547" maxBufferPoolSize="258547"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> </binding>

I am connecting to a WCF based webservice. For certain methods, the input contains a list of objects/structures. When the number of items in this list increases beyond a certain number, the service fails with HTTP/1.1 400 Bad Request when I try to test the same using SOAPUI. I tried changing the web.config file with the following changes:

<httpRuntime maxRequestLength="2097151" /> <binding name="basicHTTP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" maxReceivedMessageSize="4194304" maxBufferSize="98547" maxBufferPoolSize="258547"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> </binding>

最满意答案

该问题已通过maxReceivedMessageSize设置解决。 最初在我的绑定中,虽然声明并设置了basicHttpBinding ,但我没有显式设置bindingConfiguration 。

因为绑定中的maxReceivedMessageSize中的此类更改未应用,并且默认设置为64kb处于活动状态。 我已经设置了绑定:

<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" name="AMS" bindingName="basicHttpBinding" contract="Entity.AccuchekMobility.Service.IAccuchekMobilityService" /> <binding name="basicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:02:00" sendTimeout="00:01:00" maxReceivedMessageSize="4194304" maxBufferPoolSize="524288" maxBufferSize="4194304">

The issue was solved by the maxReceivedMessageSize setting. Initially in my binding, I did not set the bindingConfiguration explicitly, though the basicHttpBinding was declared and set.

As such changes in maxReceivedMessageSize in the binding was not getting applied and the default setting of 64kb was active. I have set the bindings like:

<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" name="AMS" bindingName="basicHttpBinding" contract="Entity.AccuchekMobility.Service.IAccuchekMobilityService" /> <binding name="basicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:02:00" sendTimeout="00:01:00" maxReceivedMessageSize="4194304" maxBufferPoolSize="524288" maxBufferSize="4194304">

更多推荐

本文发布于:2023-07-31 20:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1347277.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:HTTP   WCF   webservice   large   input

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!