У меня проблема с подключением к моему ldap.Он продолжает выдавать мне COMExceptionError (неверный параметр)
Вот код, который у меня есть:
static void Main(string[] args)
{
DirectoryEntry ldapConnection = new DirectoryEntry("10.9.130.113:667");
ldapConnection.Path = "LDAP://ou=Users,ou=CorporateStore,ou=Absa,c=za";
ldapConnection.AuthenticationType = AuthenticationTypes.Anonymous;
DirectorySearcher ds = new DirectorySearcher(ldapConnection);
SearchResult result = ds.FindOne();
Console.ReadLine();
if (result != null)
{
ResultPropertyCollection fields = result.Properties;
foreach (String ldapField in fields.PropertyNames)
{
foreach (Object myCollection in fields[ldapField])
Console.WriteLine(String.Format("{0,-20} : {1}",
ldapField, myCollection.ToString()));
Console.ReadLine();
}
Это строка, в которой происходит ошибка:
SearchResult result = ds.findOne();
Вот исключение Ошибка и трассировка стека:
System.Runtime.InteropServices.COMException was unhandled
Message=The parameter is incorrect.
Source=System.DirectoryServices
ErrorCode=-2147024809
StackTrace:
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindOne()
at LDAPConnector.Program.Main(String[] args) in c:\documents and settings\expn261\my documents\visual studio 2010\Projects\LDAPConnector\LDAPConnector\Program.cs:line 23
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Есть идеи?