cancel
Showing results for 
Search instead for 
Did you mean: 

Load Report Failed - Server Only

Former Member
0 Kudos

Hello,

I have an asp.net C# application hosted on an Amazon EC2 server. I am trying to select a report using:

    ReportDocument rep;

    protected void Page_Load(object sender, EventArgs e)

    {

        string reportPath = Server.MapPath((string)Utils.GetSessionNavigator(this).GetDataFromCurrentPage(PageParams.Reports.Report));

        if (!IsPostBack)

        {

            rep = new ReportDocument();

        }

        try

        {

            if (!File.Exists(reportPath))

            {

                Response.Write("The specified report does not exist \n");

            }

            rep.Load(reportPath);

            //LoadReport(rep);

            rep.SetDatabaseLogon("******", "******");

            this.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;

            this.CrystalReportViewer1.HasToggleGroupTreeButton = false;

            this.CrystalReportViewer1.ReportSource = rep;

        }

        catch (Exception ex)

        {

            Response.Write(ex.Message);

        }

    }

    private void Page_Unload(object sender, EventArgs e)

    {

        rep.Close();

        rep.Dispose();

    }

The report path is pointing towards my folder containing the reports, and the relevant file is being found with File.Exists, however upon using rep.Load, the exception message 'Load Report Failed" is being posted.

I have installed the correct runtimes as I have another application running on the same server, and that isn't having the same issues. Perhaps the reportPath is different but I am not sure.

Any advice would be greatly appreciated.

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

former_member188030
Active Contributor
0 Kudos

Hi Patrick,

What version of CR and VS are you using?

How did you deploy the application and reports?

Try running process monitor. Search the log for report name. It will tell you the exact reason whyc the report is not getting loaded.

Also, search the forum. This error is discussed many times before. Lots of info available.

- Bhushan

Senior Engineer

SAP Active Global Support

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Getting started and moving ahead with Crystal Reports .NET applications.

Former Member
0 Kudos

CR for Visual Studio 2010 13.0.2

I deploy the reports with the application upon publishing in VS on my development PC.

I'll try the Process Monitor overnight and post my result in the morning.

Thank you.

former_member188030
Active Contributor
0 Kudos

You might want to upgrade to SP9, both development (install exe) and server (MSI).

http://scn.sap.com/docs/DOC-7824

Also, compare the file sizes of the report files (.rpt) from your machine and server.

The publish method ( some of the options from the tool) sometime messes up with the rpt files and they turn to 10 kb, so you might want to check.

- Bhushan

Former Member
0 Kudos

Hi Bhushan,

I checked the size of the .rpt files and was surprised to see that they had shrunk to 1KB. I have begun replacing these files with ones not included in my Published web project, and they are working great!

Is this common and what causes it?

Thank you for your help.

former_member188030
Active Contributor
0 Kudos

Glad that it worked.

The cause is like a niddle in a haystack...:. I did remember seeing something like this and have a KB created for it but it is not available on SCN yet.

1245654 - A Crystal Reports.NET web application deployed using the Visual Studio 'Publish' option, t...

Here is the solution from KB. (Works for VS 2010 too)

  1. Compile the web application in Visual Studio.
  2. On completion of the build as success, go to Build -> Publish Web Site.
  3. In Publish Web Site window, set the target location.
  4. Check the Allow this precompiled site to be updatable checkbox (by default it is unchecked).
  5. Check the Use fixed naming and single page assemblies checkbox (by default it is unchecked).
  6. Click OK to proceed ahead and publish the web application.

&

Make sure that the Crystal reports in server machine are of the same size as the one in development machine, to ensure.

But I still copy the CR reports manually.. but thats just my way.

Thanks,

Bhushan

Answers (0)