WCF REST 服务模板 4.0“错误请求" [英] WCF REST Service Template 4.0 "Bad Request"

查看:18
本文介绍了WCF REST 服务模板 4.0“错误请求"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个大的 json 字符串发送到使用 WCF REST 服务模板创建的 WCF 服务.如果字符串超过 8000 个字符,我会收到HTTP/1.1 400 Bad Request"错误.我尝试将其添加到我的网络配置中:

I am trying to send a large json string to a WCF Service created with the WCF REST Service Template. If the string is longer 8000 characters I get a "HTTP/1.1 400 Bad Request" error. I have tried added this to my web config:

    <bindings>
        <webHttpBinding>
            <binding name="httpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"/>
        </webHttpBinding>
    </bindings>

有什么想法吗?

推荐答案

如果你想传递大字符串,你还必须设置readerQuotas:

You must also setup readerQuotas if you want to pass large strings:

<bindings>
    <webHttpBinding>
        <binding name="httpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
           <readerQuotas maxStringContentLength="50000" />
        </binding>
    </webHttpBinding>
</bindings>

这篇关于WCF REST 服务模板 4.0“错误请求"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆