我对此完全是新手
尝试连接到 LDAP 服务器PrincipalContext
。我已经尝试了该网站上的所有解决方案,但均无济于事。
我尝试过的事情:
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 服务器不可用
Only ContextType.Machine
基本上有效。
不确定我的 LDAP 服务器是否设置正确:
- 主机:本地主机
- 端口:389
- 基本 DN:dc=maxcrc,dc=com
- URL: 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 */
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)