wcf messageEncoding="Mtom"

Client端向远程wcf地址上传文件出现异常,异常内容:

{"Content Type multipart/related; type=\"application/xop+xml\";start=\"<http://tempuri.org/0>\";boundary=\"uuid:8ef500df-a89a-4984-ac44-7500f85b0320+id=1\";start-info=\"text/xml\" was not supported by service http://10.38.25.87/ContentService.svc.  The client and service bindings may be mismatched."}

解决办法:

去掉messageEncoding="Mtom"属性

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
<binding name="BasicHttpBinding_ContentService" closeTimeout="00:10:00"
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
          textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" >
            <!--messageEncoding="Mtom"-->
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://10.38.25.87/ContentService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ContentService" contract="ContentService.ContentService" name="BasicHttpBinding_ContentService" />

    </client>
  </system.serviceModel>

参考

  MTOM以及在WCF中的应用

  WCF中使用MTOM消息传输优化机制

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值