G
Guest
I'm searching in AD for computers (objectClass=computer) in a few
domains. The search works just fine in "small" domains with less than
1,000 of computer entries, and failed on domain with more than 4,000
entries. I do receive only first 560 objects and either get a timeout,
or app is never stopped.
Using System.DirectoryServices....
foreach (SearchResult r in searcher.FindAll())
{
....
}
I get an exception "DirectoryServicesCOMException: More data is
available" on the line with searcher.FindAll()
Using System.DirectoryServices.Protocols....
PageResultRequestControl pageRequest =
new PageResultRequestControl(20);
searchRequest.Controls.Add(pageRequest);
SearchOptionsControl searchOptions =
new SearchOptionsControl(SearchOption.DomainScope);
searchRequest.Controls.Add(searchOptions);
while (true)
{
....
}
(as descibed at http://msdn2.microsoft.com/en-us/library/bb332056.aspx)
I receive only first 28 of pages (560 computers) and a message
"DirectoryOperationException: The time limit set by the server-side
time limit parameter was exceeded."
If I set an additional settings to increase the timeout e.g.
connection.Timeout = new TimeSpan(0, 3, 30);
then after 560 entries and a while (about 1-2 min) I get another page
(#29) with 10(!) computers only (PageResultRequestControl(20)) and app
goes to hang.
So, my question is how to solve this problem and get all of computers?
Environment: ASP.NET2, DC - Win2000
domains. The search works just fine in "small" domains with less than
1,000 of computer entries, and failed on domain with more than 4,000
entries. I do receive only first 560 objects and either get a timeout,
or app is never stopped.
Using System.DirectoryServices....
foreach (SearchResult r in searcher.FindAll())
{
....
}
I get an exception "DirectoryServicesCOMException: More data is
available" on the line with searcher.FindAll()
Using System.DirectoryServices.Protocols....
PageResultRequestControl pageRequest =
new PageResultRequestControl(20);
searchRequest.Controls.Add(pageRequest);
SearchOptionsControl searchOptions =
new SearchOptionsControl(SearchOption.DomainScope);
searchRequest.Controls.Add(searchOptions);
while (true)
{
....
}
(as descibed at http://msdn2.microsoft.com/en-us/library/bb332056.aspx)
I receive only first 28 of pages (560 computers) and a message
"DirectoryOperationException: The time limit set by the server-side
time limit parameter was exceeded."
If I set an additional settings to increase the timeout e.g.
connection.Timeout = new TimeSpan(0, 3, 30);
then after 560 entries and a while (about 1-2 min) I get another page
(#29) with 10(!) computers only (PageResultRequestControl(20)) and app
goes to hang.
So, my question is how to solve this problem and get all of computers?
Environment: ASP.NET2, DC - Win2000