我在服务器上收到错误“加载报告失败”,它在localhost上运行没有错误.我正在使用VS 2008和.Net 3.5.
这是我的代码:
ReportDocument reportDocument = new ReportDocument(); String filePath = @"C:\abcSpaces\abc.com\xyz.com\wwwroot\Order Fulfilment.rpt";//full path // I have tried OrderFullfilment.rpt and ~/OrderFullfilment.rpt and /OrderFullfilment.rpt try { reportDocument.Load(filePath); CrystalReportViewer1.ReportSource = reportDocument; } catch(Exception ex){ Label1.Text = ex.Message; }
Aspx页面部分:
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" Height="1291px" ReuseParameterValuesOnRefresh="True" Width="1125px" />
^我尝试过使用
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server"> <Report FileName="expenseRep_summary.rpt"> </Report> </CR:CrystalReportSource>
当然没有运气……
我的web.config部分用于引用程序集:
<compilation debug="true"> <assemblies> <add assembly="System.Core,Version=3.5.0.0,Culture=neutral,PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions,PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Data.DataSetExtensions,PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Xml.Linq,PublicKeyToken=B77A5C561934E089"/> <add assembly="MysqL.Data,Version=6.2.4.0,PublicKeyToken=C5687FC88969C44D"/> <add assembly="MysqL.Data.Entity,PublicKeyToken=C5687FC88969C44D"/> <add assembly="MysqL.Web,PublicKeyToken=C5687FC88969C44D"/> <add assembly="CrystalDecisions.Web,Version=10.5.3700.0,PublicKeyToken=692FBEA5521E1304"/> <add assembly="CrystalDecisions.Shared,PublicKeyToken=692FBEA5521E1304"/> <add assembly="CrystalDecisions.ReportSource,PublicKeyToken=692FBEA5521E1304"/> <add assembly="CrystalDecisions.CrystalReports.Engine,PublicKeyToken=692FBEA5521E1304"/><add assembly="CrystalDecisions.ReportAppServer.ClientDoc,PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Enterprise.Framework,PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Enterprise.InfoStore,PublicKeyToken=692fbea5521e1304"/> <add assembly="CrystalDecisions.Data.AdoDotNetInterop,PublicKeyToken=692FBEA5521E1304"/> <add assembly="CrystalDecisions.VSDesigner,PublicKeyToken=692FBEA5521E1304"/></assemblies> </compilation>
我已尝试在stackoverflow中发布的所有这些解决方案:
CrystalReport Load report failed(不,我无法更改注册表或重新安装水晶报表,我的网站托管在外部服务器上)
load report failed(地狱是objReport ??)
I got the problem in Crystal Report- Error Messsage:Load report failed(我没有任何对象报告类:S)
Load report failed when implementing crystal report in asp.net 3.5(我试过这个’〜’技术绝对路径,没有工作)
Load report failed in Windows server 2003(我已经为每个文件设置了读写执行权限)
https://stackoverflow.com/questions/3337185/crystal-report-giving-load-failed-error(像我这样的人,尚未找到解决方案:P)
所以请帮助我!或者我的客户会活着吃我…
解决方法
我知道这是一个老帖子.但对于仍在寻找答案的人:
<% @ Register Assembly="CrystalDecisions.Web,Version=13.0.2000.0,PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
crystalreportsource中文件的路径为〜/ bin / YOURFOLDER / YOURFILE
<CR: CrystalReportSource ID ="CrystalReportSource1" runat ="server"> <Report FileName="~/bin/oilmovement/rptOMDayEnd.rpt"> </Report> </CR: CrystalReportSource>
现在报告应该有效