【问题标题】:Crystal report fails to load when application is deployed in IIS在 IIS 中部署应用程序时水晶报表无法加载
【发布时间】:2022-02-16 20:06:30
【问题描述】:

我将 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) ....

这是.aspx代码后面的.cs代码,用于reportxx.rpt

m_reportxx = new reportxx();
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;

DataTable dt = data.GetReport();

reportxx.SetDataSource(dt);

CrystalReportViewer1.ReportSource = m_reportxx;

我试过这个,它在 Visual Studio 环境中调试时工作。

【问题讨论】:

    标签: crystal-reports


    【解决方案1】:

    我知道这是一篇旧帖子。但对于仍在寻找答案的人:

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

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

    现在报告应该可以工作了

    【讨论】:

      【解决方案2】:

      在我的例子中,我在 2 天前发现了错误并且没有发现任何错误...最后我使用 Procmon.exe (https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx?f=255&MSPPError=-2147217396) 来跟踪错误。 我按 Result + is not + SUCCESS 过滤,我尝试再次运行 Web 应用程序并出现错误:ACCESS DENIED 到文件夹 X。 我授予 X 文件夹正确的权限并且工作正常。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多