0

我們已將.net framework 3.5,iis 7.0,Windows server 2008 R2遷移到.net framework 3.5,iis 8.5,Windows server 2012 。 AD工作不正常。一旦應用程序池回收,應用程序工作後,它不能正常工作。System.DirectoryServices.DirectorySearcher導致「算術運算導致溢出」錯誤

我收到以下與使用DirectorySearcher.FindOne()或FindAll()查詢AD有關的間歇性錯誤。

System.DirectoryServices.DirectorySearcher造成「算術運算導致溢出」錯誤

System.OverflowException:算術運算導致溢出。 在System.DirectoryServices.SearchResultCollection.ResultsEnumerator.GetCurrentResult() 在System.DirectoryServices.SearchResultCollection.ResultsEnumerator.get_Current() 在System.DirectoryServices.SearchResultCollection.ResultsEnumerator.System.Collections.IEnumerator.get_Current()

回答

0

似乎,喜歡同樣的問題,因爲這裏描述:

System.DirectoryServices.DirectorySearcher causing "Arithmetic operation resulted in overflow" errors

一種解決方案是回收應用程序池更頻繁。 另一個(如果您有權訪問源代碼)是用System.DirectoryServices.Protocols命名空間(LdapConnection,SearchRequest等)中的基於LDAP的類替換DirectorySearcher.FindXXX方法。

+0

感謝您的回覆dmitry。 –

+0

你能解釋我如何使用System.DirectoryServices.Protocols而不是DirectorySearcher.Findone()來實現LdapConnection嗎? –

+0

以下鏈接解釋瞭如何創建一個類似於DirectorySearcher的LDAP搜索器:http://dunnry.com/blog/2008/06/05/PagedAsynchronousLDAPSearchesRevisited.aspx。您可以更改搜索器以在需要時同步工作 – oldovets

相關問題