【发布时间】:2019-01-12 07:50:18
【问题描述】:
我有一个应用程序,用户通过我们的 Active Directory 进行身份验证:
private bool Authenticate()
{
using (var context = new PrincipalContext(ContextType.Domain, Environment.UserDomainName))
{
return context.ValidateCredentials(this.Username.Text.Trim(), this.Password.Text.Trim());
}
}
它工作了好几年。现在,我们的 Windows 7 机器被 Windows 10 取代,一些用户收到此错误:
服务器无法处理目录请求。
在 System.DirectoryServices.Protocols.ErrorChecking.CheckAndSetLdapError(Int32 错误)
在 System.DirectoryServices.Protocols.LdapSessionOptions.FastConcurrentBind()
在 System.DirectoryServices.AccountManagement.CredentialValidator.BindLdap(NetworkCredential creds, ContextOptions contextOptions)
在 System.DirectoryServices.AccountManagement.CredentialValidator.Validate(字符串用户名,字符串密码)
在 System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials(字符串用户名,字符串密码)
在 c:\Developing\Source\DPI\Client\DPI\FormLogin.cs:line 280 中的 DPI.FormLogin.Authenticate()
该错误仅对某些用户出现,而不是一直出现。也许这与现在 Win 10 上的安全设置比以前在 Win 7 上严格得多。
知道如何解决吗?如何查询当前连接的 LDAP 服务器?也许我们的服务器配置略有不同,问题仅限于可能配置错误的单个服务器。
【问题讨论】:
-
请试试这个:stackoverflow.com/a/11019430/3482140,如果有效,请告诉我。与您的想法类似,Kerberos 可能是原因。
ContextOptions.Negotiatemayhelp IMO。
标签: c# .net authentication active-directory domaincontroller