远程服务器返回错误:(400) 错误的请求

用WCF作为服务层提供服务,我提交的数据量很少(10条)的时候完全没问题,数据量多(300条)的时候出现远程服务器返回错误:(400) 错误的请求,经过查询提交数据量很大的时候需要在服务端进行配置:

<system.serviceModel> 
<services> 
  <!-- The name of the service --> 
  <service name="NorthwindService"> 
    <endpoint address ="YourServiceEndpoint" binding="webHttpBinding" bindingConfiguration="higherMessageSize"  contract ="System.Data.Services.IRequestHandler"> 
    </endpoint> 
  </service> 
</services> 
<bindings> 
  <webHttpBinding> 
    <binding name="higherMessageSize" maxReceivedMessageSize ="MaxMessageSize"/> 
  </webHttpBinding> 
</bindings> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> 
</system.serviceModel>

  参考地址:http://blogs.msdn.com/b/phaniraj/archive/2008/10/06/astoria-iis-http-400-bad-request-on-posting-large-payloads-to-an-astoria-service.aspx

posted @ 2013-09-23 15:42  rovoqo  阅读(1704)  评论(2编辑  收藏  举报