Crystal report fails to load when application is d

2019-01-29 01:27发布

I copied the packageTmp over to the inetpub/wwwroot, then added a website and included it as my path.

Installed the crystal report runtime, CRRuntime_32bit_13_0_4 - but still did not work.

I also have crystalreportviewers13 folder in wwwroot/aspnet _client/systemweb/4_0_30319

This is the error I encountered when I go to the page with crystal report. May i know where the path is defined? This problem occurs when I deploy my application in IIS.

Exception Details: System.Runtime.InteropServices.COMException: Invalid file name.

Source Error:

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.

Stack Trace:

[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) ....

This is the .cs code behind the .aspx code,for reportxx.rpt

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

DataTable dt = data.GetReport();

reportxx.SetDataSource(dt);

CrystalReportViewer1.ReportSource = m_reportxx;

I tried this and it worked while debugging in the visual studio environment.

2条回答
ら.Afraid
2楼-- · 2019-01-29 02:21

I know this is an old post. but For anyone still looking for the answer:

You need to register crystal reports in page markup

<% @ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

Set the property 'Copy to Output Directory' of the report to 'Copy always'

the path of the file in the crystalreportsource will be ~/bin/YOURFOLDER/YOURFILE

<CR: CrystalReportSource ID ="CrystalReportSource1" runat ="server">
            <Report FileName="~/bin/oilmovement/rptOMDayEnd.rpt">
            </Report>
        </CR: CrystalReportSource>

Now the report should work

查看更多
时光不老,我们不散
3楼-- · 2019-01-29 02:30

In my case, I found by 2 days the error and not see nothing wrong...Finally I used Procmon.exe (https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx?f=255&MSPPError=-2147217396) to trace the error. I Filter by Result + is not + SUCCESS, I tried to run again the web application and appear the Error: ACCESS DENIED to Folder X. I give the right permission to X folder and works fine.

查看更多
登录 后发表回答