Error 504 gatewayTimeout while generate report

Stimulsoft Reports.WEB discussion
Post Reply
rashid.smd
Posts: 4
Joined: Wed Aug 09, 2017 6:13 am

Error 504 gatewayTimeout while generate report

Post by rashid.smd »

Hi. i use stimulsoft for generate report in my website. the reports generates fine with no problem but when the number of record for reports increases the report was not generate and a dialog show error 504: gateway timeout. i was also set maxRequestLength and executionTimeout to a big value in web.config but the problem is was not solved. please help to fix this. thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Error 504 gatewayTimeout while generate report

Post by Alex K. »

Hello,

If you have already set large values for maxRequestLength and executionTimeout options, then it is possible on your hosting not to set too large values, or there are some restrictions. Please try to ask this question to your hosting provider.

Thank you.
rashid.smd
Posts: 4
Joined: Wed Aug 09, 2017 6:13 am

Re: Error 504 gatewayTimeout while generate report

Post by rashid.smd »

Thanks for your reply
the error fixed when i decreasing value of maxRequestLength and executionTimeout but now sometimes while generating report internal server error occur. i move my code in try block and the exception is object reference not set to an instance of an object. this is my action that throws exception

Code: Select all

public virtual ActionResult ShowPlanReport()
        {
            //List<Plan> result = Session["PlanList"]  as List<Plan>;
            List<ReportPlanFullViewModel> FinalResult = new List<ReportPlanFullViewModel>();
            var db = new anjomanEntities();
            Stimulsoft.Report.StiReport mainReport = new Stimulsoft.Report.StiReport();
            try
            {
                foreach (Plan temp in reportList)
                {
                    ReportPlanFullViewModel model = new ReportPlanFullViewModel();
                    model.PlanID = temp.ID;
                    model.Farmer = temp.Farmer;
                    model.NationalCode = temp.NationalCode;
                    model.System = temp.WaterSystem.Name;
                    model.RainArea = temp.RainArea;
                    model.DropArea = temp.DropsArea;
                    model.Mobile = temp.Mobile;
                    model.Address = temp.Address;
                    model.Village = temp.Village;
                    if (db.PlanTopograpger.Where(x => x.PlanID == temp.ID).Count() > 0)
                    {
                        model.Topograph = db.PlanTopograpger.FirstOrDefault(x => x.PlanID == temp.ID).Topographer.Name;
                        model.Topograph += " ";
                        model.Topograph = db.PlanTopograpger.FirstOrDefault(x => x.PlanID == temp.ID).Topographer.Family;
                    }
                    else
                    {
                        model.Topograph = "";
                    }
                    if (db.PlanDesignerAdvisor.Where(x => x.PlanID == temp.ID).Count() > 0)
                    {
                        model.Design = db.PlanDesignerAdvisor.FirstOrDefault(x => x.PlanID == temp.ID).Advisor.Name;
                        model.Design += " ";
                        model.Design += db.PlanDesignerAdvisor.FirstOrDefault(x => x.PlanID == temp.ID).Advisor.Family;
                    }

                    else if (db.PlanDesignerCompany.Where(x => x.PlanID == temp.ID).Count() > 0)
                    {
                        model.Design = db.PlanDesignerCompany.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
                    }
                    else
                    {
                        model.Design = "";
                    }
                    if (db.PlanChecker.Where(x => x.PlanID == temp.ID).Count() > 0)
                    {
                        model.Checker = db.PlanChecker.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
                    }
                    else
                    {
                        model.Checker = "";
                    }
                    if (db.PlanExecute.Where(x => x.PlanID == temp.ID).Count() > 0)
                    {
                        model.Executer = db.PlanExecute.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
                    }
                    else if (db.PlanExeHistory.Where(x => x.PlanID == temp.ID).Count() > 0)
                    {
                        model.Executer = db.PlanExeHistory.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
                    }
                    else
                    {
                        model.Executer = "";
                    }
                    if (db.PlanValidate.Where(x => x.PlanID == temp.ID && x.Validate == true && x.PlanExecute == true).Count() > 0)
                    {
                        model.ValidDate = ToJalali(db.PlanValidate.FirstOrDefault(x => x.PlanID == temp.ID && x.Validate == true && x.PlanExecute == true).ValidDate);
                    }
                    else
                    {
                        model.ValidDate = "";
                    }
                    model.Andikator = "";
                    model.Price = "";
                    model.TempDate = "";
                    FinalResult.Add(model);


                }
                
                mainReport.Load(Server.MapPath("~/Report/PlanReport.mrt"));
                mainReport.RegBusinessObject("plan_business", FinalResult);
                
            }
            catch(Exception c)
            {
                //
            }
            
            return Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(mainReport);
        }
this action execute with no exception for small report. any idea?
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Error 504 gatewayTimeout while generate report

Post by Ivan »

Hello,

Can you reproduce the problem on the local machine, or only on the real server?
Can you please send us a simple test project, which reproduces the issue, for analysis?

Thank you.
rashid.smd
Posts: 4
Joined: Wed Aug 09, 2017 6:13 am

Re: Error 504 gatewayTimeout while generate report

Post by rashid.smd »

The error happen just on server and on local machine there is no error.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Error 504 gatewayTimeout while generate report

Post by Edward »

Hi Rashid,

Please check the approach from the following topic:

viewtopic.php?t=37144

And if it does not help, then please send us the test project.

Thank you,
Edward
Post Reply