pepe_gaetano
pepe_gaetano

Reputation: 1

LDAP Error:The directory service is not available

I have a problem with LDAP, I use apache directory server and I would add a new user .... I use Visual Studio and the code snippet is:

public static void prova(string FullName)
{          
   DirectoryEntry container;
   DirectoryEntries ChildEntry;

   container = new DirectoryEntry("LDAP://localhost:10389/cn=user1,ou=users,ou=system", "admin", "secret");

   try
   {
       ChildEntry = container.Children;
       DirectoryEntry NewEntry = ChildEntry.Add("cn=" + FullName, "user");
       NewEntry.CommitChanges();
       NewEntry.Close();
   }
   catch (Exception ex)
   {
       throw new Exception("Error " + ex.Message);
   }
}

The problem is that I have this type of error:

The directory service is not available

somebody could help me?

Upvotes: 0

Views: 5303

Answers (2)

geoffc
geoffc

Reputation: 4100

It is as likely that your bind dn of admin is not sufficient.

You should be providing a full LDAP style DN for your LDAP user.

Like: cn=admin,ou=users,ou=system

(Seems unlikely that the root most object is of class OU, (your ou=system parts) but possible. Most LDAP implementations I have dealt with do not use this particular convention, rather they root the tree in an O= or a DC=. I suppose it depends on the specific schema if that is allowed).

Upvotes: 0

orjan
orjan

Reputation: 1482

Is it possible to telnet to the server or connect with a LDAP browser e.g LdapExplorerTool: http://ldaptool.sourceforge.net/

telnet localhost 10389

If it's not possible the server is not responding and you show check your ldap server.

I think the main LDAP-port is 389 and it might be worth a try.

Upvotes: 1

Related Questions