Support redundant LDAP servers?

Jul 7, 2011 at 12:33 AM

I've been looking for a fully managed solution to querying our Active Directory servers and your code looks great!

If I wanted to try a list of servers to provide rudimentary redundancy in a transparent way could you point me in the right direction.
Would you recommend handling it in BuildConnection or maybe deferring until SendRequest?


Jul 8, 2011 at 4:36 AM

That is a good idea.  My first instinct is to add it to BuildConnection and call Bind on the connection to verify it is valid (LdapException with a message of "The LDAP server is unavailable." will be thrown if it's not).  If you get that exception then you can move on to the next server in your list.  However, SendRequest may give you more flexibility in switching servers since that's when the actual request to the server is made so there's a smaller chance for failure in between.  To do that you could either update the QueryCommands or DirectoryQueryProvider to support requesting a connection rather than receiving one as a parameter.

I must add that from my experience S.DS.P with AD is pretty good about choosing an available server for you.  The server name can either be a domain or a specific server name.  If you use then the Active Directory Locator will kick in and find an available server in your domain for you.

Aug 31, 2011 at 9:00 PM

I didn't know about the Locator so for now I will just change the calls to LdapConnectionFactory passing in the domain instead of the hostname.