首页 > 解决方案 > C# nettcpbinding 禁用 ntlm

问题描述

连接到 WCF 服务时如何禁用 NTLM?我想确定我使用的是 Kerberos,但是 .netstandard20 中的 ChannelFactory 没有选项:

channelFactory.Credentials.Windows.AllowNtlm = false;

所以目前我无法禁用“回退”到 NTLM 以检查 Kerberos 是否正常工作。

标签: c#wcfkerberosntlm

解决方案


这是一个已弃用的属性。Kerberos只要服务器和客户端环境支持身份验证,就会首先使用Windows Kerberos身份验证。如果双方的机器环境都不支持,是否降级NTLM认证将由电脑策略决定。
https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.security.windowsclientcredential.allowntlm?view=netframework-4.8
正如描述所说。

此属性已弃用,仅为了向后兼容而维护。本地计算机策略将用于确定是否应使用 NTLM。

以下是一些相关链接。
https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/network-security-restrict-ntlm-ntlm-authentication-in-this-domain
https://docs .microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/network-security-allow-local-system-to-use-computer-identity-for-ntlm
https://developers。 de/blogs/damir_dobric/archive/2009/08/16/enabling-of-ntlm-on-windows-7-and-windows-server-2008-r2.aspx


推荐阅读