2013-04-23 42 views
0

下面是相關代碼:收到COMException錯誤時做LDAP呼叫

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 

GetAllOccurencesOfProperty - 方法:

以下是錯誤消息:

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

我可以在LDAP瀏覽器中瀏覽該地址。

回答

0

解決方案: ldap必須大寫。 我將ldap://DC.opent_dom.local:389/OU=Rådmann,OU=Jevnaker Kommune,OU=brukere,DC=opent_dom,DC=local更改爲

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