asp.net – Crystal Reports“加载报告失败”错误在服务器上运行报告

我在服务器上收到错误“加载报告失败”,它在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, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="MySql.Data, Version=6.2.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
            <add assembly="MySql.Data.Entity, Version=6.2.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
            <add assembly="MySql.Web, Version=6.2.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
            <add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
            <add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
            <add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
            <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/><add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.Data.AdoDotNetInterop, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
            <add assembly="CrystalDecisions.VSDesigner, Version=10.5.3700.0, Culture=neutral, 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, Culture=neutral, 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>

现在报告应该有效

转载注明原文:asp.net – Crystal Reports“加载报告失败”错误在服务器上运行报告 - 代码日志