开发者

Silverlight WCF Security with Custom Bindings

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?


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


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜