COMException-error when doing LDAP-call

0

Here is the relevant code:

    string ldapPath = Settings.Default.LDAPServer + Settings.Default.StartPath;
entry = new DirectoryEntry(ldapPath, username, password, AuthenticationTypes.None);
     `entry.Properties[propertyName]` // The exception is throwed at this line inside of 

the GetAllOccurencesOfProperty-method:

Here is the error message:

2013-04-23 13:55:44,895 ERROR [12] EPiServer.DataAbstraction.ScheduledJob.ExecuteStaticMethod - 3.1.2 Failed to execute job 94d9b172-591b-4893-8d29-1204b99cf8bd
System.Exception: CurrentPrincipal: eivind. LDAP: ldap://DC.opent_dom.local:389/. Error:System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
at SSP.ADPhonebook.Job.LDAP.GetAllOccurencesOfProperty(DirectoryEntry entry, String propertyName) in C:\repo\products\EPiServer\src\trunk\SSP.ADPhonebook\Job\LDAP.cs:line 80
at SSP.ADPhonebook.Job.ADOUAndUserImport.Import.GetDirectoryEntryPage(DirectoryEntry entry) in C:\repo\products\EPiServer\src\trunk\SSP.ADPhonebook\Job\ADOUAndUserImport.cs:line 117
at SSP.ADPhonebook.Job.ADOUAndUserImport.Import.Execute() in C:\repo\products\EPiServer\src\trunk\SSP.ADPhonebook\Job\ADOUAndUserImport.cs:line 61
at SSP.ADPhonebook.Job.ADOUAndUserImport.Execute() in C:\repo\products\EPiServer\src\trunk\SSP.ADPhonebook\Job\ADOUAndUserImport.cs:line 31
at SSP.ADPhonebook.Job.ADOUAndUserImport.Execute() in C:\repo\products\EPiServer\src\trunk\SSP.ADPhonebook\Job\ADOUAndUserImport.cs:line 39

ldapPath: ldap://DC.opent_dom.local:389/OU=Rådmann,OU=Jevnaker Kommune,OU=brukere,DC=opent_dom,DC=local

I can browse that address in a LDAP-browser.

c#
.net
ldap

1 Answer

0

Solution: ldap must be in caps. I changed ldap://DC.opent_dom.local:389/OU=Rådmann,OU=Jevnaker Kommune,OU=brukere,DC=opent_dom,DC=local to

LDAP://DC.opent_dom.local:389/OU=Rådmann,OU=Jevnaker Kommune,OU=brukere,DC=opent_dom,DC=local
answered on Stack Overflow Apr 23, 2013 by Anders Branderud

User contributions licensed under CC BY-SA 3.0