“<Module>”的类型初始值设定项抛出异常,算术运算导致溢出

The type initializer for '<Module>' threw an exception and Arithmetic operation resulted in an overflow

相同的代码在 Windows 7 32 位中运行。但在 windows 8 64 位中失败。有任何想法吗?谢谢

我刚刚解决了。此应用程序需要 32 位模式,而我的 Windows 8 机器中的 IIS 默认以 64 位模式运行。对于此应用程序正在使用的 AppPool,我必须将 Enable 32-bit Applications 设置为 true。

并且它没有在特定的代码行上失败。异常在 Application_BeginRequest 和 Session_Start

之间的某处抛出