zoukankan      html  css  js  c++  java
  • WCF The remote server returned an error: (400) Bad Request

    如果是小数据量调用WCF服务不会出现,但如果大量数据时会出现这个错误。花了几个小时的时间才知道WCF服务层也需要bindingConfiguration属性,修改服务层的web.config
    web.config
    ==========
    <services>
    <service name="DocCube.BusinessLogic.DocumentManager"
    behaviorConfiguration="HttpGetBehavior">
    <endpoint binding="wsHttpBinding" bindingConfiguration="wsHttp"
    contract="DocCube.Interfaces.IDocumentManager"
    address=""/>
    </service>
    </services>

    注意: 手动增加 "bindingConfiguration" 属性,VS平台不会自动生成这个属性,与bindingConfiguration关联的配置如下:

    <bindings>
    <wsHttpBinding>
    <binding name="wsHttp" maxReceivedMessageSize ="9999999"
    messageEncoding="Mtom" maxBufferPoolSize="9999999" >
    <readerQuotas maxDepth="9999999"
    maxArrayLength="9999999" maxBytesPerRead="9999999"
    maxNameTableCharCount="9999999" maxStringContentLength="9999999"/>
    <security mode="None" />
    </binding>
    </wsHttpBinding>
    </bindings>

    然后,把客户端的App.config文件删除,重新获取服务层的服务引用,需要注意到是:客户端和服务端引用的绑定协议binding都需要相同,比如客户端的app.config引用的binding,maxReceivedMessageSize 值大小等于9999999,那么服务层也要有相同的配置,这个值也是9999999。

  • 相关阅读:
    JS可改变列宽table
    无图片,用css border实现尖三角
    IE6下position:fixed;兼容
    巧用cssText属性批量操作样式
    Java
    Java
    Java
    JRebel
    Spring
    ActiveMQ
  • 原文地址:https://www.cnblogs.com/Kingly/p/1455046.html
Copyright © 2011-2022 走看看