Active directory Active Directory-身份验证失败

Active directory Active Directory-身份验证失败,active-directory,Active Directory,我正在尝试使用以下代码进行身份验证: public IEnumerable<string> SearchADUsers(string username) { DirectoryEntry entry = new DirectoryEntry("LDAP://rhc.local"); DirectorySearcher dSearch = new DirectorySearcher(entry); entry.AuthenticationType = Aut

我正在尝试使用以下代码进行身份验证:

public IEnumerable<string> SearchADUsers(string username)
{
    DirectoryEntry entry = new DirectoryEntry("LDAP://rhc.local");

    DirectorySearcher dSearch = new DirectorySearcher(entry);

    entry.AuthenticationType = AuthenticationTypes.Delegation;

    foreach (SearchResult sResultSet in dSearch.FindAll())
    {
        Console.WriteLine(GetProperty(sResultSet, "cn"));
    }
    return null;
}
public IEnumerable SearchADUsers(字符串用户名)
{
DirectoryEntry=newdirectoryEntry(“LDAP://rhc.local”);
DirectorySearch dSearch=新的DirectorySearch(条目);
entry.AuthenticationType=AuthenticationTypes.Delegation;
foreach(dSearch.FindAll()中的SearchResult sResultSet)
{
Console.WriteLine(GetProperty(sResultSet,“cn”);
}
返回null;
}
但我得到了一个错误:

000004DC:LDAPPER:DSID-0C0906E8,注释:为了执行此操作 操作必须在连接数据上完成成功绑定 0,v1db1


为什么要设置AuthenticationType?谢谢,现在已解决为什么要设置AuthenticationType?谢谢,现在已解决