-2

I'm new to C# winforms application Development, Currently I was working on a winforms application having Crystal Reports and Was working fine on Debugging and Without Debugging Mode During Development. But When I deployed it and Run On Client PC, its Giving me an error while I try to open any Crystal Report.

Its Giving the Error of Report Load Failed -->.

************** Exception Text **************
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException: Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.
   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   --- End of inner exception stack trace ---
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
   at ePos._forms._pos._reports.customerLedgerReport.ShowReport(DataTable dtable)
   at ePos._forms._pos._reports.customerLedgerReport.customerLedgerReport_Load(Object sender, EventArgs e)

Kindly help me out, will be so much thankful to You. :)

Ali Barkati
  • 3
  • 2
  • 4

1 Answers1

2

The only cause to this issue is that “The application could not find the crystal report (.rpt )” be whatever the reason.

Here are the possible reasons for this error message.

  • The report location specified in the ‘Load ()’ method is invalid or
    report does not exist at that location.
    :

    This happens because while developing the application, report location is specified from the dev machine but once the application is deployed, the location changes with respect to IIS folder structure.

    Check the path of .rpt file. This will Probably solve it

    Server.MapPath("~/Reports/InvoiceRegular.rpt");
    

    OR-- Right click the Rpt file->Choose the properties-> Changed

    • Build Action as "Content".
    • Copy to Output Directory as "Do not Copy".
    • Put Empty for Custom Tool and Custom Tool Namespace.
  • Reports are not intact : If the Reports are published using visual studio ‘Publish’ option but if not published properly there is a possibility that the reports may loose content or get corrupted. The best way to check this is too compare the report sizes from the Dev and Prod / client machine.

  • Random change of permissions or Security / Access policy: This is a possible cause when some times the report works but sometimes it throws the error. You may want to check the Security policy applied to your machine/ domain if the rights for your application over the report location are variable / changing. Use Process Monitor and look for any access denied errors or permission issues.

  • All the possible causes to the ‘Load report failed’ error message also apply to this issue as well. Here’s the best article written by Ludek which covers them all.http://scn.sap.com/docs/DOC-21995

  • The other strong cause to this issue is the print job limit of the Crystal print engine getting exceeded. Consider a scenario where the application performs multiple view / export / print functions on reports, reports work fine most of the times but intermittently throw this exception. Below is the document you might want to take a look at to resolve this issue.http://scn.sap.com/docs/DOC-21533

vijay7790
  • 66
  • 4
  • I am using Winforms and there is no Server.MapPath(); and my code is : `public void ShowReport(DataTable dtdata) { crystalReportViewer.SelectionMode = CrystalDecisions.Windows.Forms.SelectionMode.None; ReportDocument rdoc = new ReportDocument(); rdoc.Load(@"@reports/rptBalanceSheet.rpt"); rdoc.SetDataSource(dtdata); crystalReportViewer.ReportSource = rdoc; }` – Ali Barkati Apr 11 '16 at 12:08
  • @GrantWinney thanks for your kind reply.. :) and I have already show you the code. – Ali Barkati Apr 11 '16 at 13:18
  • @GrantWinney sorry.. Can you please help me out. I'm still in this trouble. :( – Ali Barkati Apr 11 '16 at 13:57
  • I think its may be the Problem of access policy but don't know how can I solve this.. – Ali Barkati Apr 11 '16 at 13:58