0

我有一个调用许多 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 配合使用?

4

2 回答 2

2

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

<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

于 2011-03-25T10:43:27.360 回答
1

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

<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-03-25T10:41:45.120 回答