【问题标题】:Silverlight WCF Security with Custom Bindings具有自定义绑定的 Silverlight WCF 安全性
【发布时间】:2011-03-25 10:14:57
【问题描述】:

我有一个调用多个 WCF 服务的 silverlight 应用程序。 Silver Light 客户端的典型绑定如下所示:

<basicHttpBinding>
    <binding name="ClientBindingName" maxBufferSize="2147483647"
        maxReceivedMessageSize="2147483647">
        <security mode="TransportCredentialOnly" />
    </binding>
</basicHttpBinding>

这与这样的服务器绑定配对:

<basicHttpBinding>
    <binding name="ServerbindingName" sendTimeout="00:02:00">
        <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
        </security>                    
    </binding>
</basicHttpBinding>

对于其中一项服务,我需要自定义绑定,但我找不到不会导致 403 错误的绑定组合。

我能为客户想出的最好办法是:

<customBinding>
    <binding name="CustomBinding_IZipService_StreamedResponse" closeTimeout="00:10:00"
             openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
        <binaryMessageEncoding />
        <httpTransport maxReceivedMessageSize="2147483647"
                       maxBufferSize="2147483647"
                       transferMode="StreamedResponse" />
    </binding>
</customBinding>

对于服务:

<customBinding>
    <binding name="FS.SUV.Services.ZipService.customBinding"
             receiveTimeout="00:10:00" sendTimeout="00:10:00">
      <binaryMessageEncoding>
        <readerQuotas maxStringContentLength="524288000"/>
      </binaryMessageEncoding>
      <httpTransport transferMode="StreamedResponse"
                     maxBufferSize="524288000"
                     maxBufferPoolSize="524288000"
                     maxReceivedMessageSize="524288000" />
      <security authenticationMode="SecureConversation" requireSecurityContextCancellation="true">
        <secureConversationBootstrap authenticationMode="UserNameOverTransport" />
      </security>
    </binding>
  </customBinding>

如何通过 windows 身份验证获得自定义绑定以与 silverlight 配合使用?

【问题讨论】:

    标签: silverlight wcf windows-authentication custom-binding


    【解决方案1】:

    事实证明我试图过于复杂。客户端绑定很好,因此保留为:

    <binding name="CustomBinding_IZipService_StreamedResponse" closeTimeout="00:10:00"
             openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
        <binaryMessageEncoding />
        <httpTransport maxReceivedMessageSize="2147483647"
                       maxBufferSize="2147483647"
                       transferMode="StreamedResponse" />
    </binding>
    

    并且需要像这样设置服务器绑定:

    <customBinding>
        <binding name="ClientBindingName"
                 receiveTimeout="00:10:00" sendTimeout="00:10:00">
            <binaryMessageEncoding>
                <readerQuotas maxStringContentLength="524288000"/>
            </binaryMessageEncoding>
            <httpTransport transferMode="StreamedResponse"
                           maxBufferSize="524288000"
                           maxBufferPoolSize="524288000"
                           maxReceivedMessageSize="524288000"
                           authenticationScheme="Negotiate" />
        </binding>
    </customBinding>
    

    我设法通过使用这代工具获得绑定权:http://webservices20.cloudapp.net/default.aspx

    【讨论】:

    • 是的,因为您的初始配置没有使用传输身份验证,而是使用 Silverlight 不支持的具有安全上下文的消息身份验证。
    【解决方案2】:

    您的配置不正确。在两边都试试这个(并根据需要修改读者配额和邮件大小限制):

    <customBinding>
        <binding name="CustomBinding_IZipService_StreamedResponse" closeTimeout="00:10:00"
                 openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
            <binaryMessageEncoding />
            <httpTransport authenticationMode="Negotiate"
                           maxReceivedMessageSize="2147483647"
                           maxBufferSize="2147483647"
                           transferMode="StreamedResponse" />
        </binding>
    </customBinding>
    

    【讨论】:

      猜你喜欢
      • 2011-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-04
      相关资源
      最近更新 更多