具有自定义绑定的 Silverlight WCF 安全性

发布于 2024-10-25 19:57:41 字数 2109 浏览 1 评论 0原文

我有一个 silverlight 应用程序调用许多 WCF 服务。 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 配合良好?

I have a silverlight app that calls a number of WCF services. The typical bindings for the silver light client looks like this:

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

and that's paired with the server bindings like this:

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

For one of the services I require a custom binding, but I am unable to find a combination of bindings that don't result in a 403 error.

The best I can come up with for the client is:

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

and for the service:

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

how can I get custom bindings to play nice with silverlight over windows authentication?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

指尖微凉心微凉 2024-11-01 19:57:41

事实证明我想得太复杂了。客户端绑定很好,因此保留为:

<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

It turns out I was trying to be too complex. The client binding was fine and so was left as:

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

and the server binding needed to be set like this:

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

I managed to get the binding right by using this gen of a tool: http://webservices20.cloudapp.net/default.aspx

提笔书几行 2024-11-01 19:57:41

您的配置不正确。在两侧尝试此操作(并根据需要修改读者配额和消息大小限制):

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

Your configuration is incorrect. Try this on both sides (and modify reader quotas and message size limits as you need):

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文