2
votes

I am getting "ASP.NET session has expired" error when viewing a (SQL server reporting services) report using report viewer control. sometimes it works fine and sometimes I get this error, it works fine in Dev, but not in test environment. Please let me know if you have any clues. thanks in advance. here is the code for the report viewer control.

ReportViewer1.ServerReport.ReportServerUrl = new Uri(System.Configuration.ConfigurationManager.AppSettings["ReportServerUrl"]);

    ReportViewer1.ServerReport.ReportPath = System.Configuration.ConfigurationManager.AppSettings["ReportPath"];
    ReportViewer1.ServerReport.SetParameters(new List<ReportParameter> { new ReportParameter("key", "value") });
    ReportViewer1.DataBind();
3
Hi RKP, did my answer help or are you still having issues? - WooHoo
I am trying out a suggestion of using "ReportViewer1.LocalReport.Refresh" to fix this issue as stated at this link eggheadcafe.com/software/aspnet/31537344/…. I want to increase the session timeout only as a last resort. thanks for your reply. - RKP
Good luck, but my suggestion isn't to increase session time out. It's the idle timeout, even if you increase the session timeout the idle timeout can kick in on systems that aren't accessed frequently. Anyway good luck. - WooHoo

3 Answers

0
votes

Take a look at the application pool in iis, check the advanced settings->process model->idle timeout (minutes). Set this higher than 20 mins. Sounds like the worker process is shutting down because its idle. Often this happens with test systems because they don't get that many hits to stop the idle timeout from kicking in.

Cheers Tigger

0
votes

I had a problem with these symptoms for months on a production server and was never able to reproduce it reliably on any development or test server. I was going nuts, until some quirky configuration change finally made ASP.NET log a new warning whenever this session expired error occurred.

Long story short, my problem was a bug in Report Viewer. It's been bugged on Connect and I added a workaround to the case which may help you:

https://connect.microsoft.com/VisualStudio/feedback/details/556989/

Before doing any drastic workarounds, first check Event Viewer on the test server and look for an ASP.NET warning event around the time you hit this error. See if the event makes mention of the 'IterationId' parameter.

0
votes

I fixed it by setting AsyncRendering to false for the report viewer control. just a temporary workaround until I find a proper solution.