'How to fix Load report failed in crystal report

I'm setting up a crystal report for my table, i followed all the instruction to fix the load report failed, giving full control permission to temp folder even the file path and still have an error : Load Report Failed, 'CrystalDecisions.Shared.CrystalReportsException'

Here is my code

public ActionResult OccupiedReport()  
    {
        List<ReservationModel.OccupiedStatus> Occupied = new List<ReservationModel.OccupiedStatus>();
        string constr = ConfigurationManager.ConnectionStrings["MyCnn"].ConnectionString;
        using (MySqlConnection con = new MySqlConnection(constr))
        {
            string query = "SELECT * FROM room_status WHERE check_out >= CURDATE() and status ='occupied'";
            using (MySqlCommand cmd = new MySqlCommand(query))
            {
                cmd.Connection = con;
                con.Open();
                using (MySqlDataReader sdr = cmd.ExecuteReader())
                {
                    while (sdr.Read())
                    {
                        Occupied.Add(new ReservationModel.OccupiedStatus
                        {
                            DormName = sdr["Dorm_Name"].ToString(),
                            RoomNumber = sdr["Room_Number"].ToString(),
                            BedNumber = sdr["Bed_Number"].ToString(),
                            GuestName = sdr["Guess_Name"].ToString(),
                            Classification = sdr["Classification"].ToString(),
                            Gender = sdr["Gender"].ToString(),
                            CheckIn = sdr["Check_In"].ToString(),
                            CheckOut = sdr["Check_Out"].ToString(),
                            StatusType = sdr["Status"].ToString()
                        });
                    }

                }
                con.Close();
                ReportDocument rd = new ReportDocument();
                rd.FileName = Server.MapPath("/CrReport/CrystalReport1.rpt");
                rd.Load(Server.MapPath("~/CrReport/CrystalReport1.rpt"));
                rd.SetDataSource(Occupied);

                Response.Buffer = false;
                Response.ClearContent();
                Response.ClearHeaders();


                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return File(stream, "application/pdf", "CustomerList.pdf");

            }
        }


    }  

An exception of type 'CrystalDecisions.Shared.CrystalReportsException' occurred in CrystalDecisions.CrystalReports.Engine.dll but was not handled in user code

Additional information: Load report failed.



Solution 1:[1]

Sound like it either problems with report path, try the suggestion here : code project

Or if that's not the problem, is there more than one version of CR installed in the machine ? because that causes problems like this one. Try to unistall and install the correct version again.

Solution 2:[2]

I experienced same issue. ON Server it loads report but after sometime it generate this error.After Restarting IIS Application Error resolve and then it comes again . This occur randomly.Following document help me to resolve my issue Solving The “Load Report Failed” Error

Crystal Report Document needs to be manually disposed.You need to close Report document. It actually creates temprary files in Windows Temp Folder

You should control the lifetime of all Reports in your application and call their Dispose before reaching the 75 limit.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TheOne__
Solution 2 Saima Gul