我是新手
尝试使用 PrincipalContext
连接到 ldap 服务器。我已经尝试了该站点上的所有解决方案,但均无济于事。
我尝试过的事情:
PrincipalContext insPrincipalContext =
new PrincipalContext(ContextType.Domain);
PrincipalContext insPrincipalContext =
new PrincipalContext(ContextType.Domain, "ldap://localhost:389/dc=maxcrc,dc=com");
PrincipalContext insPrincipalContext =
new PrincipalContext(ContextType.Domain, "maxcrc.com");
都给出相同的结果:
LDAP server not available
只有 ContextType.Machine
基本可以工作。
不确定我的 LDAP 服务器是否设置正确:
- 主机:本地主机
- 端口:389
- 基本 DN:dc=maxcrc,dc=com
- 网址:ldap://localhost:389/dc=maxcrc,dc=com
使用 Softerra LDAP 浏览器进行测试
任何从头到尾的教程都将不胜感激...
最佳答案
我一直面临同样的问题,我找到了解决方案。
我可以使用以下代码轻松连接:
ADUser_Id = "domainName\\username"; //make sure user name has domain name.
Password = "xxxx";
var context = new PrincipalContext(ContextType.Domain,"server_address", ADUser_Id,Password);
/* server_address = "192.168.15.36"; //don't include ldap in url */
关于c# - LDAP 服务器不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14480258/