【问题标题】:Arithmetic operation resulted in an overflow算术运算导致溢出
【发布时间】:2011-05-15 17:57:54
【问题描述】:

该应用程序在 Win server 2003 /IIS 6.0 环境中运行良好。 当我将代码移动到 win server 2008/IIS 7.0 时,出现以下错误?您能否告知错误原因是什么?我错过了什么吗?

Server Error in '/' Application.

Arithmetic operation resulted in an overflow. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.OverflowException: Arithmetic operation resulted in an overflow.

堆栈跟踪:

[OverflowException:算术运算导致溢出。] System.IntPtr.ToInt32() +37 CoreLab.Common.a.a(代表 A_0)+1935 CoreLab.Oracle.ab.a(OracleConnection A_0) +214 CoreLab.Oracle.OracleConnection.Open() +375 MonsterWorldwide.iTime.DataAccess.TimecardDA.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotal) 在 c:\inetpub\wwwroot\mtitimeproduction\dataaccess\timecardda.cs:28 MonsterWorldwide.iTime.BusinessLogic.TimecardBL.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotal) 在 c:\inetpub\wwwroot\mtitimeproduction\businesslogic\timecardbl.cs:24 MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.LoadData() 在 c:\inetpub\wwwroot\mtitimeproduction\webgui\webparts\timecardlist.ascx.cs:112 MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.Page_Load(Object sender, EventArgs e) 在 c:\inetpub\wwwroot\mtitimeproduction\webgui\webparts\timecardlist.ascx.cs:52 System.Web.UI.Control.OnLoad(EventArgs e) +132 System.Web.UI.Control.LoadRecursive() +66 System.Web.UI.Control.LoadRecursive() +191 System.Web.UI.Control.LoadRecursive() +191 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428


版本信息:Microsoft .NET Framework 版本:2.0.50727.4952; ASP.NET 版本:2.0.50727.4927

【问题讨论】:

  • 你能发布堆栈跟踪和导致错误的代码吗?
  • [OverflowException: 算术运算导致溢出。] System.IntPtr.ToInt32() +37 CoreLab.Common.aa(Delegate A_0) +1935 CoreLab.Oracle.ab.a(OracleConnection A_0) +214 CoreLab.Oracle.OracleConnection.Open() +375 MonsterWorldwide.iTime.DataAccess.TimecardDA.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotalc:\inetpub\wwwroot\mtitimeproduction\dataaccess\timecardda.cs:28MonsterWorldwide。 iTime.BusinessLogic.TimecardBL.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotal)
  • 在 c:\inetpub\wwwroot\mtitimeproduction\businesslogic\timecardbl.cs:24 MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.LoadData() 在 c:\inetpub\wwwroot\mtitimeproduction\webgui\ c:\inetpub\wwwroot\mtitimeproduction\webgui\webparts\timecardlist.ascx.cs:52 系统中的 webparts\timecardlist.ascx.cs:112 MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.Page_Load(Object sender, EventArgs e)。 Web.UI.Control.OnLoad(EventArgs e) +132 System.Web.UI.Control.LoadRecursive() +66 System.Web.UI.Control.LoadRecursive() +191 System.Web.UI.Control.LoadRecursive() +
  • 191System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
  • ------------------------------------------ -------------------------------------- 版本信息:Microsoft .NET Framework 版本:2.0.50727.4952 ; ASP.NET 版本:2.0.50727.4927

标签: asp.net-mvc iis-7 overflow


【解决方案1】:
[OverflowException: Arithmetic operation resulted in an overflow.] 
System.IntPtr.ToInt32() +37 
CoreLab.Common.a.a(Delegate A_0) +1935 
CoreLab.Oracle.ab.a(OracleConnection A_0) +214

这看起来像是一些写得很糟糕的非托管互操作代码,它没有考虑 CPU 类型,并且在 x64 位操作系统中运行时会崩溃。在 64 位操作系统中,指针是 64 位整数,与 32 位操作系统相反。

也许你应该检查你正在使用的这个 CoreLab.Common 组件的文档,它是否支持 64 位系统。

引用IntPtr.ToInt32方法的文档:

OverflowException:在 64 位平台上,此实例的值太大或太小而无法表示为 32 位有符号整数。

【讨论】:

  • 是的。目前我使用的是 64 位操作系统 ..这可能是罪魁祸首。
  • 罪魁祸首是您使用的组件与 64 位操作系统不兼容。
  • 好的,谢谢。我安装了 32 位 corelab 组件。
  • 但我无法在 64 OS 上安装 Oracle 客户端 64 位组件。任何想法?提前致谢
  • 你用的是什么Oracle客户端?
猜你喜欢
  • 2011-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多