天天看点

解决Crystal Report XI R2不能在64操作系统正常工作的问题-web程序

我更换了新的电脑,操作系统也从原来32位的windows 2003 R2升级到windows 2008 R2 x64, 由于客户的原因我们的报表部分必须用Crystal Report XI R2来完成,报表在原来的计算机上运行一直没有问题,但是在新的计算机上一直不能正工作,错误如下:

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.

Stack Trace:

at CrystalDecisions.CrystalReports.Engine.ReportDocument.CheckForCrystalReportsRuntime()

at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()

Inner Exception:

An error has occurred while attempting to load the Crystal Reports runtime.

Either the Crystal Reports registry key permissions are insufficient or the Crystal Reports runtime is not installed correctly.

在我确定我安装了CRRedist2008_x64.msi和CRRedist2008_x86.msi 两个包后问题依旧如此, 其实问题根本就不是CRRedist2008_x64.msi和CRRedist2008_x86.msi 安装与否的问题, 后来我想到了Application Pools,问题果然出在这里, 以我的环境为例解决办法如下:

1. 打开IIS并选择你的Web程序所使用的application pool, 并点击右侧Actions栏中的Advanced Settings

解决Crystal Report XI R2不能在64操作系统正常工作的问题-web程序

2. 在打开的窗口中设置Enabled 32-Bit Applications为True,

解决Crystal Report XI R2不能在64操作系统正常工作的问题-web程序

只需要设置这一个属性就可以了,再次运行程序并打开报表,报表可以正常工作了。

另外:

Crystal Report XI R2不能运行在64位作系统下

这种方式是错误的: 在VS2005/2008 中,鼠标右键点击引用Crystal Report XI R2的项目并选择Properties, 在打开的属性窗口选择Build标签,将Platform target设置为x86,再次运行程序时会报错。在64位操作系统中编译x86平台的能运行的程序必要设置Application Pool的Enable 32-Bit Applications

继续阅读