在我们公司,我们有一个项目,应该使用Novell eDirectory和.net应用程序。我尝试过Novell (http://www.novell.com/coolsolutions/feature/11204.html)在.NET应用程序之间进行连接。它很好用。
但是,根据需求,我们特别需要.net Api来连接不工作的Novell。与.NET Api DirectoryServices的连接和绑定无法工作。
我们的Novell eDirectory安装有以下凭据:
我使用了Novell Api并使用了以下代码
String ldapHost ="10.0.x.xx";
String loginDN = "cn=admin,cn=WIxxxK01-NDS,OU=STATE,o=ORG";
String password = string.Empty;
String searchBase = "o=ORG";
String searchFilter = "(objectclass=*)";
Novell.Directory.Ldap.LdapConnection lc = new Novell.Directory.Ldap.LdapConnection();
try
{
// connect to the server
lc.Connect(ldapHost, LdapPort);
// bind to the server
lc.Bind(LdapVersion, loginDN, password);
}这是正确的绑定和搜索可以完成。
现在我的问题是,当我尝试使用.NET APi和使用System.DirectoryServices或System.DirectoryServices.Protocols时,它不是连接或绑定。
我甚至不能测试下面的DirectoryEntry.Exists方法。会有例外的。
string myADSPath = "LDAP://10.0.x.xx:636/OU=STATE,O=ORG";
// Determine whether the given path is correct for the DirectoryEntry.
if (DirectoryEntry.Exists(myADSPath))
{
Console.WriteLine("The path {0} is valid",myADSPath);
}
else
{
Console.WriteLine("The path {0} is invalid",myADSPath);
}它的意思是Server is not operational或Local error occurred等,我不知道目录路径发生了什么。
我试过了
DirectoryEntry de = new DirectoryEntry("LDAP://10.0.x.xx:636/O=ORG,DC=witsxxx,DC=companyname,DC=com", "cn=admin,cn=WIxxxK01-NDS,o=ORG", "admin");
DirectorySearcher ds = new DirectorySearcher(de, "&(objectClass=user)");
var test = ds.FindAll();都会有例外。
你能帮我解决这个问题吗?userDN for DirectoryEntry应该如何?
我也使用System.DirectoryServices.Protocols.LdapConnection与LdapDirectoryIdentifier和System.Net.NetworkCredential,但没有结果。只有同样的例外。
感谢你宝贵的时间和帮助。
谢谢你,比努
发布于 2012-08-09 14:33:39
要诊断LDAP连接错误,可以从管理员访问eDirectory服务器,并使用iMonitor (serverIP:8028/nds并选择iMonitor),在Dstrace中清除所有选项卡并启用LDAP跟踪,然后绑定查看LDAP端发生的情况,以查看是否存在更多描述性错误。或者你甚至有足够的距离来绑定和建立连接。
https://stackoverflow.com/questions/11672277
复制相似问题