WCF - 客户端和>服务绑定可能不匹配 [英] WCF - The client and > service bindings may be mismatched

查看:86
本文介绍了WCF - 客户端和>服务绑定可能不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:

  

内容类型的multipart /相关;   TYPE =应用程序/ XOP + XML;启动=的http://tempuri.org/0";boundary="uuid:ba0ec7a3-1707-44b9-be72-2fe11d4dfe2b+id=4";start-info="text/xml"   是不支持的服务   的http://ServerName/FolderName/ServiceName.svc 客户端和   服务绑定可能不匹配。

客户端配置:

 <结构>
    < system.serviceModel>
        <绑定>
            < basicHttpBinding的>
                <绑定名称=BasicHttpBinding_IServicecloseTimeout =00:01:00
                    openTimeout =00:01:00receiveTimeout =00:10:00的SendTimeout =00:01:00
                    allowCookies =假bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcard
                    maxBufferSize =65536maxBufferPoolSize =524288maxReceivedMessageSize =65536
                    messageEncoding =MTOMtextEncoding =UTF-8transferMode =缓冲
                    useDefaultWebProxy =真正的>
                    < readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =16384
                        maxBytesPerRead =4096maxNameTableCharCount =16384/>
                    <安全模式=无>
                        <交通运输clientCredentialType =无proxyCredentialType =无
                            境界=/>
                        <消息clientCredentialType =用户名algorithmSuite =默认/>
                    < /安全>
                < /装订>
            < / basicHttpBinding的>
        < /绑定>
        <客户端>
            <端点地址=HTTP://本地主机:1371 / Service.svc
                绑定=basicHttpBinding的bindingConfiguration =BasicHttpBinding_IService
                合同=Service.IServiceNAME =BasicHttpBinding_IService/>
        < /客户>
    < /system.serviceModel>
< /结构>
 

服务器配置:

 <绑定>
       < basicHttpBinding的>
          <绑定名称=BasicHttpBinding_IServicecloseTimeout =00:01:00
             openTimeout =00:01:00receiveTimeout =00:10:00的SendTimeout =00:01:00
             allowCookies =假bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcard
             maxBufferSize =2147483647maxBufferPoolSize =524288maxReceivedMessageSize =2147483647
             messageEncoding =MTOMtextEncoding =UTF-8transferMode =流媒体
             useDefaultWebProxy =真正的>
             < readerQuotas MAXDEPTH =2147483647maxStringContentLength =2147483647
                maxArrayLength =2147483647maxBytesPerRead =2147483647maxNameTableCharCount =2147483647/>
             <安全模式=无>
                <交通运输clientCredentialType =无proxyCredentialType =无
                   境界=/>
                <消息clientCredentialType =用户名algorithmSuite =默认/>
             < /安全>
          < /装订>
< / basicHttpBinding的>
    < /绑定>
 

解决方案

从删除 messageEncoding 位的 basicHttpBinding的结合。目前它设置为MTOM的犯规让的为text / xml 的传输。

更多信息<一个href="http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.messageencoding.aspx"相对=nofollow>这里。

Error:

Content Type multipart/related; type="application/xop+xml";start="http://tempuri.org/0";boundary="uuid:ba0ec7a3-1707-44b9-be72-2fe11d4dfe2b+id=4";start-info="text/xml" was not supported by service http://ServerName/FolderName/ServiceName.svc. The client and service bindings may be mismatched.

Client Config :

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:1371/Service.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
                contract="Service.IService" name="BasicHttpBinding_IService" />
        </client>
    </system.serviceModel>
</configuration>

Server Config :

<bindings>
       <basicHttpBinding>         
          <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
             openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
             allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
             messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
             useDefaultWebProxy="true">
             <readerQuotas maxDepth="2147483647" 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>

解决方案

Remove the messageEncoding bit from your basicHttpBinding binding. It's currently set to "MTOM" which doesnt allow text/xml transmission.

More info here.

这篇关于WCF - 客户端和&GT;服务绑定可能不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆