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

时间:2012-01-24 21:16:17

标签: silverlight wcf-binding

我从Silverlight应用程序中使用了WCF。自从我对绑定配置进行了更改后,它开始出现以下错误。

错误:

  

内容类型application / soap + xml; charset = utf-8被发送到期望application / soap + msbin1的服务。客户和服务   绑定可能不匹配。

WCF服务器的Web.config配置:

  <customBinding>
    <binding name="WCFSilverlightService">
      <security authenticationMode="IssuedTokenOverTransport" requireDerivedKeys="false" includeTimestamp="true">
        <issuedTokenParameters keyType="BearerKey" tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"/>
        <secureConversationBootstrap/>
      </security>
      <!-- Error started coming when I added the below binaryMessageEncoding section -->
      <binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" maxSessionSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      </binaryMessageEncoding>
      <httpsTransport maxBufferPoolSize="2147483647"
        maxReceivedMessageSize="2147483647"
        maxBufferSize="2147483647"/>
    </binding>
  </customBinding>

Silverlight ClientConfig文件中的配置:

      <customBinding>
    <binding name="BearerTokensOverTransport" sendTimeout="00:05:00" receiveTimeout="00:10:00">
      <!-- Error started coming when I added the below binaryMessageEncoding section -->
      <binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" maxSessionSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      </binaryMessageEncoding>
      <httpsTransport maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
    </binding>
  </customBinding>

1 个答案:

答案 0 :(得分:1)

这恰好发生在我身上,问题是我在web.config中的 services 元素中没有正确的命名空间。

http://msdn.microsoft.com/en-us/library/ms733932.aspx

例如, name 属性应该具有“完全限定名称,该名称由命名空间,句点和类型名称组成。例如”MyNameSpace.myServiceType“。”

我确保web.config中的命名空间都是正确的。