在IIS中部署应用程序时,Crystal报表无法加载

时间:2012-10-18 16:57:41

标签: crystal-reports

我将packageTmp复制到inetpub / wwwroot,然后添加了一个网站并将其作为我的路径。

安装了水晶报告运行时CRRuntime_32bit_13_0_4 - 但仍无法正常工作。

我还在wwwroot / aspnet _client / systemweb / 4_0_30319中有crystalreportviewers13文件夹

这是我使用水晶报告进入页面时遇到的错误。我可以知道路径的定义在哪里吗?当我在IIS中部署我的应用程序时会发生此问题。

异常详细信息:System.Runtime.InteropServices.COMException:文件名无效。

来源错误:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

堆栈追踪:

[COMException (0x800001fb): Invalid file name.] CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270 [CrystalReportsException: Load report failed.] CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +877 CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob) +1183 CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport() +113 CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) +53 CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable) ....

对于reportxx.rpt

,这是.aspx代码背后的.cs代码
m_reportxx = new reportxx();
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;

DataTable dt = data.GetReport();

reportxx.SetDataSource(dt);

CrystalReportViewer1.ReportSource = m_reportxx;

我试过这个,它在Visual Studio环境中进行调试时有效。

2 个答案:

答案 0 :(得分:0)

我知道这是一个老帖子。但对于仍在寻找答案的人来说:

您需要在页面标记中注册水晶报告

<% @ 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>

现在报告应该有效

答案 1 :(得分:0)

在我的情况下,我发现错误2天并没有看到任何错误...最后我使用 Procmon.exe https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx?f=255&MSPPError=-2147217396)来追踪错误。 我按结果 + + 成功过滤,我尝试再次运行Web应用程序并显示错误: ACCESS DENIED < / strong>到文件夹 X 。 我给X文件夹正确的权限,并且工作正常。