active-directory - LDAP 无效凭据 - Active Directory Windows Server 2012 R2
问题描述
我以前没有使用过 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 命令行,我也收到了同样的错误。任何帮助将不胜感激。 截屏
解决方案
这很模糊,但是您被拒绝的原因在错误消息中。真正的错误是data
字段的值。在这种情况下,错误是0x2030
。
将值转换为十进制以获取8240
.
然后查找错误。FormatMessage API 将为您提供,或者在命令行上,您将执行以下操作:
net helpmsg 8240
你会得到
There is no such object on the server.
这意味着您使用的用户名不存在,有错字等。
推荐阅读
- ruby-on-rails - 模型关联问题:NoMethodError: undefined method `extensions' for #
- python - 属性方法中的 Setter 方法
- java - 如何在 Android Studio 中启用按钮
- python - 使用python从字符串中提取版本?
- python - 无法使用发布请求解析某些搜索结果中的表格内容
- python - 如果我反转 Conv1D 的输入形状会发生什么?
- python - 从 python2 调用 python3 方法
- android - Android Studio,未找到 Gradle DSL 方法:'compilecmdip()'
- reactjs - 组件不在地图内呈现
- oracle - 使用 Oracle SQL Developer 导入 .sql 文件?