【发布时间】:2019-04-25 10:05:28
【问题描述】:
我以前没有使用过 Active Directory,我需要在 C# 中的 Unity 独立实现和通过 LDAP 安装在 Windows Server 2012 R2 上的 Active Directory 之间建立连接。每次连接时,我都会收到相同的错误:
LdapException: (49) 无效的凭证 LdapException:服务器消息:8009030C:LdapErr:DSID-0C0903C5,注释:AcceptSecurityContext 错误,数据 2030,v2580
我确信我的用户名和密码是正确的。
DirectoryEntry entry = new DirectoryEntry("LDAP://"+ serverName+":"+port,userName,password);
DirectorySearcher ds = new DirectorySearcher(entry);
ds.Filter = "XX";
SearchResult result = ds.FindOne();
ResultPropertyCollection rpc = result.Properties;
foreach (string property in rpc.PropertyNames)
{
foreach (object value in rpc[property])
console.text+="Property = " + property + "Value = " + value;
}
}
catch (Exception ex)
{
Debug.Log(ex);
}
我已经尝试过使用 LdapAdmin(开源 LDAP 目录管理工具),但即使在 Windows PowerShell 中使用 ldp 命令行,我也收到了同样的错误。任何帮助将不胜感激。 Screenshot
【问题讨论】:
-
你能展示你的代码吗?
-
userName中的用户名格式是什么?是domain\username还是username@domain.com? (请编辑您的问题而不是添加答案) -
我都试过了,但都出现同样的错误,你能检查一下我最近添加的截图吗?感谢您的宝贵时间。
-
请看下面的答案。你的用户名一定有错别字。这不是在骗你:)
标签: active-directory ldap windows-server-2012-r2