天天看點

解決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

繼續閱讀