I am getting the following error when trying to enumerate users in LDAP(Lightweight Directory Access Protocol). I have verified my connection string to the server (LDAP://domainname). The server is of course online and operational.
Error Message: Server is not operational
Stack Trace
[2264] System.Transactions Critical: 0 :
[2264] <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain><Exception><ExceptionType>System.Runtime.InteropServices.COMException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The server is not operational.
[2264] </Message><StackTrace>
[2264] Server stack trace:
[2264] at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
[2264] at System.DirectoryServices.DirectoryEntry.Bind()
[2264] at System.DirectoryServices.DirectoryEntry.get_AdsObject()
[2264] at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
Update - added code
DirectoryEntry dirEntry = new DirectoryEntry( "_LDAP://DOMAINNAME", "userName", "password" );
System.DirectoryServices.DirectorySearcher dirSearcher = new System.DirectoryServices.DirectorySearcher( dirEntry );
try
{
foreach ( SearchResult resEnt in dirSearcher.FindAll( ) )
{
DirectoryEntry de=resEnt.GetDirectoryEntry( );
foreach ( string propname in de.Properties.PropertyNames )
{
//Add to the datatable
}
}
}
catch ( Exception ex1 )
{
//Log exception
}
finally
{
dirEntry.Dispose( );
dirSearcher.Dispose( );
}
Any thoughts on why this expection could occur would be much appreciated?
Thanks in advance,
Bharath K