导致“算术运算导致溢出"的System.DirectoryServices.DirectorySearcher.错误 [英] System.DirectoryServices.DirectorySearcher causing "Arithmetic operation resulted in overflow" errors

查看:126
本文介绍了导致“算术运算导致溢出"的System.DirectoryServices.DirectorySearcher.错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下与使用AD查询AD有关的间歇性错误 DirectorySearcher.FindOne()FindAll().

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()

这是在Web应用程序中发生的,并且似乎是在该应用程序运行了几个小时之后发生的.

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

这是Microsoft上的记录的问题连接,但看起来它已被标记为不可复制"并关闭.

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?

我尝试使用缓存,但这只会延迟不可避免的时间,直到您达到AD调用的数量的某个阈值为止,因为人们报告说每次进行API调用

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.

任何帮助将不胜感激.

推荐答案

构建AD API并在其自己的应用程序池中运行它.每隔几个小时进行一次回收.该API将处理的只是对AD的调用.看起来您已经有了代码,只需要移至API.我发现AD API对许多其他项目也非常有用,并且继续参考它.

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.

这篇关于导致“算术运算导致溢出"的System.DirectoryServices.DirectorySearcher.错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆