Error while trying to connect AD using LDAP connection

Deadly 提交于 2019-12-22 03:47:14

问题


Trying to use this code to connect the AD

PrincipalContext context = new PrincipalContext(ContextType.Domain, domain)

but i got the error saying:

The LDAP server is unavailable.

Any idea?


回答1:


The questions is: do you specify our domain as

  • "mydomain.com" (DNS format)
  • or as "dc=mydomain,dc=com" (AD-style format)

To my surprise, the Domain name must be in DNS format (e.g. "mydomain.com") in order for this to work (and NOT in the usual AD-style format of "dc=mydomain,dc=com").




回答2:


I had the same problem.

Mine was because the webserver was not on the same domain as the user.

I resolved it by ignoring the error; this then forced an authentication challenge which enabled the user to supply credentials, which I could pick up the correct domain from.



来源:https://stackoverflow.com/questions/1023489/error-while-trying-to-connect-ad-using-ldap-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!