Execution 'iwy2vpzo52pmp555ftfn4455' cannot be found (rsExecutionNotFound)

前端 未结 6 1972
Happy的楠姐
Happy的楠姐 2021-01-13 00:56

Some users get the following error when running reports.

• Execution \'iwy2vpzo52pmp555ftfn4455\' cannot be found (rsExecutionNotFound)

They run fine in t

6条回答
  •  时光取名叫无心
    2021-01-13 01:03

    I can help.

    The problem is that the ReportViewer control uses Session to store the currently executing report. Once you navigate away from the reports, the item still remains and eventually loses its "execution context", which is the way Report Server caches reports.

    Therefore, before browsing a report, you should attempt to clear out the Session of these reports, so that there are NO cached reports in the Session, and the ReportViewer control can work properly.

    You will also find that sometimes when accessing Session.Keys.Count, this error can occur, as again, the execution context has failed.

    Make sure you do this on the page showing the report!!

    The 2 options are:

    if (!IsPostBack)
    {
        HttpContext.Current.Session.Clear();
        ReportViewer1.ServerReport.ReportServerUrl = new Uri(ReportServerUrl, System.UriKind.Absolute);
        ReportViewer1.ServerReport.ReportPath = ReportPath;
        System.Collections.Generic.List parameters = new System.Collections.Generic.List();
        ....
    
        ReportViewer1.ServerReport.SetParameters(parameters);
        ReportViewer1.ServerReport.Refresh();
    }
    

    Or

    for (int i = 0; i < HttpContext.Current.Session.Keys.Count; )
    {
       if (HttpContext.Current.Session[i].ToString() == "Microsoft.Reporting.WebForms.ReportHierarchy")
           HttpContext.Current.Session.RemoveAt(i);
       else
          i++;
    }
    

提交回复
热议问题