tags:

views:

27

answers:

0

I'm trying to read from an ADAM directory using C# as well as Delphi. On some machines the code executes very fast (sub-second). On other machines the authentication is fast but reading values from the directory takes a long time (> 12 minutes).

I am using the System.DirectoryServices.DirectoryEntry class in C# to access the directory. I have also coded the same functionality in Delphi (Win32) using the ADSI COM objects but with the same results.

I have done a WireShark trace when reading from the directory and it seems the server returns the requested data very quickly (< 3 seconds) but then the client takes its sweet time in doing whatever for another 12 minutes before returning.

Here is some additional information:

  • I have tried executing the code on a variety of machines (XP SP2, XP SP3, Vista SP1, Server 2003) and with the exception of Windows Server 2003, which is always fast, I'm getting mixed results from the other platforms.
  • Accessing the directory using LDP.exe from Windows Server 2003 Support Tools is fast from all machines.
  • Accessing the directory using third party tools that are not based on ADSI is fast from all machines (e.g Softerra LDAP Browser).
  • Accessing an IBM Tivoly Directory Server with my code is fast from all machines.

I suspect it's related to specific updates that are loaded on the machines or ADAM configuration. I'm open to suggestion though.

In C# I use the following code to read from the directory:

string path = "LDAP://server:50001/cn=test1,ou=division,o=company,c=za";
string userId = "cn=test1,ou=division,o=company,c=za";
var entry = new DirectoryEntry(path, userId, "password", AuthenticationTypes.ServerBind);
Console.WriteLine(entry.Properties["distinguishedName"].Value.ToString()); // This is slow