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

后端 未结 8 1419
不知归路
不知归路 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:31

    In my case I was seeing referrals when I was accessing AD via SSO with an account in a trusted domain. The problem went away when I connected with explicit credentials in the local domain.

    i.e. I replaced

    DirectoryEntry de = new DirectoryEntry("blah.com");
    

    with

    DirectoryEntry de = new DirectoryEntry("blah.com", "someguy@blah.com", "supersecret");
    

    and the problem went away.

提交回复
热议问题