我有一个作为 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/