Windows身份验证与Silverlight自定义绑定 [英] Windows authentication with Silverlight custom binding

查看:112
本文介绍了Windows身份验证与Silverlight自定义绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图设置安全性在IIS托管WCF服务在web.config文件中,但不断收到错误消息:


  

此服务的安全设置
  需要匿名身份验证,但
  它不是为IIS启用
  应用承载这种服务。


我已阅读聂雅伦的博客(的链接文本),看来,这是我需要采取的路线。不过,我使用binaryMessageEncoding在我的Silverlight服务customBinding,正因为如此,我不知道如何将这种类型的安全应用到这样一个元素。这就是我的自定义绑定看起来配置在present:

 < customBinding>
  <绑定名称=silverlightBinaryBinding>
    < binaryMessageEncoding />
    < httpTransport />
  < /&结合GT;
< / customBinding>

有没有人有任何获得Windows身份验证的经验用binaryMessageEncoding自定义绑定工作?


解决方案

 < httpTransport authenticationScheme =谈判/>

我的作品。

请确保您使用相同的绑定您的MEX终结:

 <&绑定GT;
    < customBinding>
        <绑定名称=myCustomBinding>
            < binaryMessageEncoding maxSessionSize =2147483647>
                < readerQuotas MAXDEPTH =2147483647maxArrayLength =2147483647maxBytesPerRead =2147483647maxNameTableCharCount =2147483647maxStringContentLength =2147483647/>
            < / binaryMessageEncoding>
            < httpTransport maxReceivedMessageSize =4194304authenticationScheme =谈判/>
        < /&结合GT;
    < / customBinding>
< /绑定>
<服务和GT;
    <服务名称=服务>
        <端点地址=绑定=customBindingbindingConfiguration =myCustomBinding合同=IService/>
        <端点地址=MEX绑定=customBindingbindingConfiguration =myCustomBinding合同=IMetadataExchange接口/>
    < /服务>
< /服务>

I am trying to set up security within a web.config file for a WCF service hosted in IIS but keep getting the error message:

Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

I have read Nicholas Allen’s blog (link text) and it appears that this is the route that I need to take. However, I am using "binaryMessageEncoding" in a customBinding for my Silverlight service, and as such, I’m not sure how to apply this type of security to such an element. This is how my custom binding looks in config at present:

<customBinding>             
  <binding name="silverlightBinaryBinding">          
    <binaryMessageEncoding />
    <httpTransport />
  </binding>
</customBinding>

Has anyone had any experience getting Windows authentication to work with a custom binding using binaryMessageEncoding?

解决方案

<httpTransport authenticationScheme="Negotiate"/>

Works for me.

Make sure you use the same binding for your mex endpoint:

<bindings>
    <customBinding>
        <binding name="myCustomBinding">
            <binaryMessageEncoding maxSessionSize="2147483647">
                <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
            </binaryMessageEncoding>
            <httpTransport maxReceivedMessageSize="4194304" authenticationScheme="Negotiate"/>
        </binding>
    </customBinding>
</bindings>
<services>
    <service name="Service">
        <endpoint address=""    binding="customBinding" bindingConfiguration="myCustomBinding" contract="IService" />
        <endpoint address="mex" binding="customBinding" bindingConfiguration="myCustomBinding" contract="IMetadataExchange" />
    </service>
</services>

这篇关于Windows身份验证与Silverlight自定义绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆