玩转CSLA.NET小技巧系列二:使用WCF无法上传附件,提示413 Entity Too Large

背景:由于系统需要展示图片,客户上传图片到本地客户端目录,然后在数据库中存储本地图片地址,和图片二进制数据

错误原因:我是使用CSLA的WCF服务,使用了数据门户,WCF协议使用的是wsHttpBinding,上传图片大小为512KB,并且已经配置了
<httpRuntime maxRequestLength="2147483647"/>
   <wsHttpBinding>
  <binding name="wsHttpBinding_IWcfPortal" maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00" messageEncoding="Mtom">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
        </binding>
      </wsHttpBinding>

  

 
上传限制到2GB,但是还是没有办法上传512KB的图片
 但是我切换到basicHttpBinding时,竟然可以上传
<httpRuntime maxRequestLength="2147483647"/>
      <basicHttpBinding>
        <binding name="basicHttpBinding_IWcfPortal" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647" maxDepth="2147483647" />
        </binding>
      </basicHttpBinding>

  

 
说实话我对WCF不是很熟悉,希望知道原因的能留个言,大家讨论下

转载于:https://www.cnblogs.com/xzxy/p/3505746.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值