“A referral was returned from the server” exception when accessing AD from C#

后端 未结 8 1394
不知归路
不知归路 2020-12-01 18:08
DirectoryEntry oDE = new DirectoryEntry(\"LDAP://DC=Test1,DC=Test2,DC=gov,DC=lk\");

using (DirectorySearcher ds = new DirectorySearcher(oDE))
{
    ds.PropertiesToL         


        
8条回答
  •  抹茶落季
    2020-12-01 18:33

    A referral was returned from the server error usually means that the IP address is not hosted by the domain that is provided on the connection string. For more detail, see this link:

    Referral was returned AD Provider

    To illustrate the problem, we define two IP addresses hosted on different domains:

    IP Address DC Name Notes

    172.1.1.10 ozkary.com Production domain

    172.1.30.50 ozkaryDev.com Development domain

    If we defined a LDAP connection string with this format:

    LDAP://172.1.1.10:389/OU=USERS,DC=OZKARYDEV,DC=COM

    This will generate the error because the IP is actually on the OZKARY DC not the OZKARYDEV DC. To correct the problem, we would need to use the IP address that is associated to the domain.

提交回复
热议问题