2

我正在使用 vb.net 和以下代码,但出现错误。我是 vb.net 和 Active Directory 的新手,请帮我解决这个问题。

我的代码:

Dim dirEntry As DirectoryEntry = New DirectoryEntry()
    dirEntry.Path = "ldap://sunbs.in:389/CN=Schema,CN=Configuration,DC=sunbs,DC=in"
    dirEntry.Username = "sunbs.in\sbsldap"
    dirEntry.Password = "sbs@123"
    Dim searcher As New DirectorySearcher
    searcher.SearchRoot = dirEntry

当我调试代码时,我在第二行出现错误。未知错误(0X80005000)

4

1 回答 1

1

尝试LDAP://为您的 使用大写前缀dirEntry.Path

Dim dirEntry As DirectoryEntry = New DirectoryEntry()

' use LDAP:// - not ldap://
dirEntry.Path = "LDAP://sunbs.in:389/CN=Schema,CN=Configuration,DC=sunbs,DC=in" 

dirEntry.Username = "sunbs.in\sbsldap"
dirEntry.Password = "sbs@123"
Dim searcher As New DirectorySearcher
searcher.SearchRoot = dirEntry
于 2012-10-04T05:23:42.650 回答