我有一个应用程序,其中用户通过我们的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服务器?也许我们的服务器配置略有不同,并且问题仅限于可能配置错误的单个服务器。