【问题标题】:WCF - The client and > service bindings may be mismatchedWCF - 客户端和 > 服务绑定可能不匹配
【发布时间】:2012-07-10 08:52:25
【问题描述】:

错误:

内容类型多部分/相关; type="application/xop+xml";start="http://tempuri.org/0";boundary="uuid:ba0ec7a3-1707-44b9-be72-2fe11d4dfe2b+id=4";start-info="text/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>

【问题讨论】:

  • 尝试将服务绑定复制到客户端
  • 将标签bindings从服务器配置复制到客户端配置
  • 我遇到了另一个异常`远程服务器返回了意外响应:(400) 错误请求。
  • 您是否浏览过端点上的 WSDL - 其中一个错误是:服务不支持“text/xml” - 所以端点可能实际上没有提供服务或指定不正确跨度>

标签: c# .net wcf


【解决方案1】:

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

更多信息here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-24
    • 2012-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    相关资源
    最近更新 更多