Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm getting the following intermittent errors related to querying AD using DirectorySearcher.FindOne() or FindAll().

System.OverflowException: Arithmetic operation resulted in an overflow.
     at System.DirectoryServices.SearchResultCollection.ResultsEnumerator.GetCurrentResult()
     at System.DirectoryServices.SearchResultCollection.ResultsEnumerator.get_Current()
     at System.DirectoryServices.SearchResultCollection.ResultsEnumerator.System.Collections.IEnumerator.get_Current()

This is happening in a web app and seems to happen after the app has been running for several hours.

This is a documented issue on Microsoft Connect but it looks like it has been marked as "not reproducible" and closed.

The only fix that I found here is to recycle the app pool periodically which is a rather harsh workaround and not viable when your users are in the middle of working.

Has anyone experienced this and if so how was this resolved?

I have tried to use caching but this just delays the inevitable until you hit a certain threshold in terms of the number of AD calls since people have reported that each time the API call is made it leaks memory.

Any help would be much appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
495 views
Welcome To Ask or Share your Answers For Others

1 Answer

Build an AD API and run it in it's own app pool. The recycle that every few hours. All the API will handle is calls to AD. looks like you already have the code, just need to move to API. I have found a AD API to be very useful for lots of other projects as well and keep going back to it as reference point.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...