wcf - 如何让 serviceCredentials > windowsAuthentication > allowedAnonymousLogons 在 WCF 中工作?

标签 wcf wcf-authentication

我有一个作为 netTcpBinding 公开的 WCF 服务。

在服务端:

<netTcpBinding>             
    <binding> 
      <security mode="Message">
        <message clientCredentialType="Windows"/>
      </security>         
    </binding>
</netTcpBinding> ...
// Service behavior
<behavior>         
    <serviceCredentials>
       <windowsAuthentication allowAnonymousLogons="true" />
     </serviceCredentials>          
</behavior>

我无法从另一台计算机上的匿名用户访问此服务。 (错误:协商失败,无法验证重新授权。)

什么是

<windowsAuthentication allowAnonymousLogons="true" /> 

做什么?

我希望 Windows 和匿名用户可以通过 net tcp 绑定(bind)访问我的服务。我可以使用用户名验证来执行此操作,但如何使用 Windows 身份验证执行此操作?

谢谢

最佳答案

您是否在客户端上设置了AllowedImpersonationLevel?

<behaviors>
    <endpointBehaviors>
      <behavior>
        <clientCredentials>
          <windows allowedImpersonationLevel="Anonymous"/>
        </clientCredentials>
      </behavior>
    </endpointBehaviors>
</behaviors>

client.ClientCredentials.Windows.AllowedImpersonationLevel = 
System.Security.Principal.TokenImpersonationLevel.Anonymous;

关于wcf - 如何让 serviceCredentials > windowsAuthentication > allowedAnonymousLogons 在 WCF 中工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16734124/

相关文章:

c# - 共享 [DataContract] 类的可移植类库

c# - WCF:将用户名和密码传递给另一项服务(无 Https)

wcf - 为什么将 ASP.NET MVC 2 用于 REST 服务?为什么不是 WCF?

wcf - 如何在 BasicHttpBinding 的 WCF 服务中进行身份验证?

c# - 来自 MVC 应用程序的 WCF 服务身份验证共享相同的成员资格提供者

wcf - 唯一证书认证和REST服务

java - Java 使用的 WCF - java.lang.NullPointerException

asp.net - 如何排除 "System.Web.HttpException (0x80004005): File does not exist"故障?

c# - 重新加载 ServiceHost 的服务配置?