user1139666
user1139666

Reputation: 1697

ASP .NET + IIS + Crystal Reports + Load report failed

I am developping a web application by using the ASP .NET MVC 3 framework.
I have implemented an ASPX page containing a CrystalReportViewer control.

I instantiate a ReportDocument object in my Page_Load event method of my ASPX page.
Then I load a RPT file by using the Load method of my ReportDocument.

My RPT is correctly loaded when I use the VS2010 development web server and I can view it through my viewer.
But the call to the Load method of my ReportDocument raises an exception when I use my IIS 5.1 local web server.

Here are some information about the exception :

Does someone know why the exception is raised when I use IIS ?

Upvotes: 1

Views: 6809

Answers (2)

ZahidKakar
ZahidKakar

Reputation: 212

I faced the same problem and what I did to solve the 'Load Report Failed' problem.

  1. First check whether your report folder exists or .rpt files in your project folder after you publish the asp.net project. I simply placed my whole project folder in the IIS root directory. I am using the my reports in 'Reports' folder that doesn't cause any error.
  2. Then copy C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13” into your project main folder like C:\inetpub\wwwroot\YourProjectFolder\.

Please, comment when this doesn't work.

Upvotes: 0

vny
vny

Reputation: 21

This works for me:

protected void Page_UnLoad(object sender, EventArgs e)
{

        this.CrystalReportViewer1.Dispose();
        this.CrystalReportViewer1 = null;
        // CrystalReportViewer1.Close();
        // CrystalReportViewer1.Dispose();
        GC.Collect();

}
protected void Button1_Click(object sender, EventArgs e)
{
    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load("C:\\inetpub\\wwwroot\\CrystalReportDemo\\CrystalReport.rpt");
    CrystalReportViewer1.ReportSource = cryRpt;
    CrystalReportViewer1.RefreshReport();
}

}

Upvotes: 2

Related Questions