問題
透過 System.DirectoryServices.DirectorySearcher 進行 AD Search 時,
發生 System.Runtime.InteropServices.COMException: ‘Unknown error (0x80005000) 的錯誤,要怎麼解決呢?
解法
使用的程式如下,
1 | using System.DirectoryServices; |
結果在 search.FindOne(); 會發生 System.Runtime.InteropServices.COMException: 'Unknown error (0x80005000) 的錯誤。
後來將 adHost 的 "ldap://你要連的 AD Server" 改成 大寫的 LDAP 問題就解掉了"LDAP://你要連的 AD Server"。
如果沒有給**LDAP://**就會噴 無法指出的錯誤 的錯誤哦~
1 | using System.DirectoryServices; |
有發生類似的問題,可以試試這個解法哦 ^_^