C# LDAP的XamlParseException
正在尝试查询LDAPC# LDAP的XamlParseException,c#,ldap,C#,Ldap,正在尝试查询LDAP DirectoryEntry de = new DirectoryEntry(); de.Path = @"dc=xxx,dc=xxx,dc=xxx,dc=edu"; de.AuthenticationType = AuthenticationTypes.Anonymous; foreach (DirectoryEntry user in de.Children) { 我有个例外 我还尝试将“LDAP://”添加到path,并将“cn=users”添加到path 同样的
DirectoryEntry de = new DirectoryEntry();
de.Path = @"dc=xxx,dc=xxx,dc=xxx,dc=edu";
de.AuthenticationType = AuthenticationTypes.Anonymous;
foreach (DirectoryEntry user in de.Children)
{
我有个例外
我还尝试将“LDAP://”
添加到path,并将“cn=users”
添加到path
同样的情况也发生在
DirectorySearcher srch = new DirectorySearcher(de);
srch.FindOne();
例外是
PresentationFramework.dll中首次出现类型为“System.Windows.Markup.XamlParseException”的异常
其他信息:“对与指定绑定约束匹配的类型“LDAPTest2.MainWindow”调用构造函数时引发异常。“行号“3”和行位置“9”
我们使用OpenDirectory,我使用与其他程序相同的设置来列出用户
编辑:
根据
marc_s
的建议,我已经在System.DirectoryServices.Protocols
上尝试了相同的方法,但是在Bind()上我得到了相同的异常
System.DirectoryServices
仅适用于Active Directory-如果需要通用LDAP连接,请查看System.DirectoryServices.Protocols
命名空间及其类
LdapConnection ldapCon;
ldapCon = new LdapConnection(new LdapDirectoryIdentifier("xxx.xxx.xxx.edu", 389));
ldapCon.AuthType = AuthType.Anonymous;
ldapCon.Bind();