WCF - 客户端和>服务绑定可能不匹配

时间:2012-07-10 08:52:26

标签: c# .net wcf

错误:

  

内容类型multipart / related;   类型= “应​​用/ XOP + xml” 的;开始= “http://tempuri.org/0”;边界= “UUID:ba0ec7a3-1707-44b9-be72-2fe11d4dfe2b + ID = 4”;启动信息= “文本/ xml” 的   服务不支持   http://ServerName/FolderName/ServiceName.svc.客户和   服务绑定可能不匹配。

客户端配置:

<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>

服务器配置:

<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>

1 个答案:

答案 0 :(得分:4)

messageEncoding绑定中删除basicHttpBinding位。它目前设置为“MTOM”,不允许 text / xml 传输。

更多信息here

相关问题