尝试连接到 Active Directory 时出现异常
作为我公司的一个项目,我尝试使用 asp.net c# 查询两个 AD。本地的和远程的。 本地的没有给我带来任何麻烦,连接,查询,一切都很好。
问题出在远程服务器(位于 ISP 位置的服务器群中)。
我收到“发生本地错误”错误。
我编写的连接代码:
DirectoryEntry directoryObject = new DirectoryEntry("LDAP://[SERVER IP ADDRESS]/OU=[THE OU],DC=[SUB DOMAIN],DC=[COMPANY DOMAIN NAME],DC=co,DC=il", "site\admin", "abc1234");
我已经检查了端口,它在防火墙中打开,我正在尝试查询 AD 用户,是的,用户列表不在用户下,而是在不同的 OU 下。
也许有人知道这一点?寻找什么?如果我使用 IP,我是否需要使用 DC 部分,我只是找不到有关此的文档...
我是否应该像我在文档中读到的那样打开 389 端口??? 谢谢你, 埃雷兹
As a project for my company I am trying to query two ADs with asp.net c#. A local one and a remote one.
The local one didn't give me any trouble, connected, queried and every thing is working great.
The problem is with the remote one (located in a servers farm at the ISP location).
I am getting the "A local error has occurred" error.
The connection code I wrote:
DirectoryEntry directoryObject = new DirectoryEntry("LDAP://[SERVER IP ADDRESS]/OU=[THE OU],DC=[SUB DOMAIN],DC=[COMPANY DOMAIN NAME],DC=co,DC=il", "site\admin", "abc1234");
I've checked the port and it is open in the Firewall and I am trying to query the AD users and YES, the users list is not under users, but under a deferent OU.
Maybe some one know this? what to look for? do i need to use the DC part if i am using an IP, i just can't find a documentation about this...
Was I supposed to open 389 port as i read in the documentation???
Thank you,
Erez
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案是AD中目录的顺序,AD中不同目录的连接是不同的。例如,用户是 cn,其他目录是 ou...
谢谢,
埃雷兹
The answer was the order of the directories in the AD, the connection to defferent directories in the AD is done defferently. user is cn and other directories are ou for example...
Thank you,
Erez
根据您的 LDAP 库,您可能无法以域\用户格式绑定到远程 AD。尝试为管理员用户使用正确的 LDAP DN。
Depending on your LDAP library, you probably cannot bind as domain\user format, to a remote AD. Try using a proper LDAP DN for the Administrator user instead.