最近在用asp.net做Web項目,項目中用到rdlc報表。rdlc報表在本地運作時OK的,但是釋出到Web伺服器上就出問題了,到網上搜了好久才搞定這個問題。
釋出rdlc報表幾個需要注意的地方:
1、 将三個DLL檔案拷貝到Web伺服器:
Microsoft.ReportViewer.Common.dll(在D:\Program Files\Microsoft Visual Studio 2010\ReportViewer找到)
Microsoft.ReportViewer.WebForms.dll(在D:\Program Files\Microsoft Visual Studio 2010\ReportViewer找到)
Microsoft.ReportViewer.ProcessingObjectModel.dll (可以去下載下傳這個DLL檔案)
或 使用cmd拷貝Microsoft.ReportViewer.ProcessingObjectModel.dll
運作:cmd
cd C:\WINDOWS\assembly
dir
cd gac_msil
dir *reportview* /s
copyC:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\9.0.0.0__b03f5f7f11d50a3a\
Microsoft.ReportViewer.ProcessingObjectModel.dll C:\
copy C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebDesign\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebDesign.dll C:\
2、設定rdlc報表屬性Build Action(生成動作)為Content(内容),改成這個屬性值是不生成DLL的,是生成rdlc報表檔案。
3、RDLC報表不能用編譯後的檔案釋出,直接拷貝編譯之前的rdlc檔案到Web伺服器
4、将ReportViewer.exe和ReportViewerLP.exe安裝到客戶伺服器端就可以預覽列印報表。