在C#LDAP搜索过程中超出了管理限制

在C#LDAP搜索过程中超出了管理限制,c#,exception,active-directory,ldap,directoryentry,C#,Exception,Active Directory,Ldap,Directoryentry,我正在尝试进行LDAP搜索,但不断出现以下错误: Unhandled Exception: System.Runtime.InteropServices.COMException (0x80072024): T he administrative limit for this request was exceeded. at System.DirectoryServices.SearchResultCollection.ResultsEnumerator.MoveNext () a

我正在尝试进行LDAP搜索,但不断出现以下错误:

Unhandled Exception: System.Runtime.InteropServices.COMException (0x80072024): T
he administrative limit for this request was exceeded.

   at System.DirectoryServices.SearchResultCollection.ResultsEnumerator.MoveNext
()
   at System.DirectoryServices.DirectorySearcher.FindOne()
下面是代码:(错误在FindOne()上抛出)


有没有办法解决这个问题?

许多LDAP服务器实现对查询中返回的结果数量有限制

AD默认为1000或2000。我一下子就忘了。eDirectory默认为无限制。其他人则各不相同


您可以要求管理员更改限制,或者对代码进行分页,使其一次只能获得一页(或有限数量的结果)。

删除了这一行,它可以工作:

dirSearcher.PropertiesToLoad.Add("uid");

必须从每个结果中获取UID,而不仅仅是匹配的结果,因此超出了管理员限制

这是针对Active Directory的LDAP,还是针对其他LDAP目录的LDAP??If other:哪一个?LDAP路径看起来有点奇怪-我不确定AD是否支持像
o=
c=
这样的东西-这些东西通常在OpenLDAP或Novell eDirectory中使用。根据Richard Mueller的参考站点(),Active Directory似乎不包含“uid”属性-必须是您正在查找的其他内容。。。。
dirSearcher.PropertiesToLoad.Add("uid");