WCF REST Service Template 4.0 “Bad Request”

一笑奈何 提交于 2019-12-13 21:26:08

问题


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>

Any ideas?


回答1:


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>


来源:https://stackoverflow.com/questions/6324194/wcf-rest-service-template-4-0-bad-request

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!