Windows authentication with Silverlight custom binding

半城伤御伤魂 提交于 2019-12-25 02:55:34

问题


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?


回答1:


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



回答2:


I too got the same issue, i fixed it by making the following changes in the end point configuration

<httpTransport authenticationScheme="Ntlm"/>

and Remove the mex endpoint




回答3:


The option of

<httpTransport authenticationScheme="IntegratedWindowsAuthentication"/>

works as well for this issue.



来源:https://stackoverflow.com/questions/2845868/windows-authentication-with-silverlight-custom-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!