Crystal report fails to load when application is deployed in IIS

crystal-reports

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.

Best Answer

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

Related Topic