C#、LDAP:试图找出 DN,但 RootDSE 回复 "invalid dn-syntax"

C#, LDAP: Trying to figure out DN, but RootDSE replies "invalid dn-syntax"

我目前正在尝试连接到远程 LDAP-Server。为此,我试图找出域:

DirectoryEntry entry = new DirectoryEntry("LDAP://141.83.80.30/lam/RootDSE");

不幸的是,我遇到了错误:

System.DirectoryServices.DirectoryServicesCOMException: 'An invalid dn-syntax was provided'

您可以使用以下代码段进行远程 LDAP 连接。

DirectoryEntry directoryEntry = new DirectoryEntry("LDAP://example.com");
directoryEntry.Path = "LDAP://OU=Specific Users,OU=All Users,OU=Users,DC=example,DC=com";