dotnet/runtime

Linux System.DirectoryServices.Protocols: does the library support multiple server connection?

Open

#100,007 opened on Mar 20, 2024

View on GitHub
 (4 comments) (1 reaction) (0 assignees)C# (5,445 forks)batch import
area-System.DirectoryServiceshelp wanted

Repository metrics

Stars
 (17,886 stars)
PR merge metrics
 (Avg merge 12d 11h) (661 merged PRs in 30d)

Description

If I create a connection and try to send request from Windows computer, then shut down the dc1 and resend the request it will succeed. I assume it will use the dc2.

var ldi = new LdapDirectoryIdentifier(new [] { "dc1.domain.com",  "dc2.domain.com" }, 389, false, false);
var conn = new LdapConnection(ldi, new NetworkCredential("user", "password")) 
{
    SessionOptions = {
      ProtocolVersion = 3
    }, 
    AuthType = AuthType.Basic
};

var req = new SearchRequest("", "(objectType=*)", SearchScope.Base, "defaultNamingContext");
conn.SendRequest(req);

If the same code executes on Linux machine it will fail with System.DirectoryServices.Protocols.LdapException: The operation was aborted because the client side timeout limit was exceeded. Does it depend on OpenLDAP library? Can I achieve the same result on Linux?

Contributor guide