Unknown Error (0x80005000) with LDAPS Connection

后端 未结 3 1006
孤城傲影
孤城傲影 2020-12-14 23:02

I\'ve been stuck for the last couple of hours on an annoying Active Directory bit.

What I\'m trying to accomplish is connect to an Active Directory via LDAP over SSL

3条回答
  •  情深已故
    2020-12-14 23:24

    As far as I remember This error means that there is a problem with the directory path name.

    1. Be sure that "server.domainName" is the CN in the certificate of your AD server.
    2. Be sure that "some.domainName" is well resolved add the resolution in your hosts file for the test
    3. Be sure that the "domainName" is well resolved add the resolution in your hosts file for the test
    4. Be sure that the public ke of the certificate authority that issue the server certificate is in your computer trusted root certification authority store.
    5. try doing like this :

    DirectoryEntry entry = new DirectoryEntry("LDAPS://srventr2.societe.fr:636/DC=societe,DC=fr", "user", "password");
    
    DirectorySearcher searcher = new DirectorySearcher();
    searcher.SearchRoot = entry;
    searcher.SearchScope = SearchScope.Subtree;
    searcher.Filter = "(&(objectCategory=person)(objectClass=user))";
    SearchResultCollection results = searcher.FindAll(); 
    

提交回复
热议问题