ReportViewer is blocking other functionalites until the loading of report viewer is completed

天大地大妈咪最大 提交于 2019-12-05 04:45:48

mean while if i try to open any link from the previous tab the page doesn't get loaded until the report in the new tab is completely loaded

You need to profile your application. Most likely your request has been queued trying to get a write lock for the user's session state.

You can read more about the problem here:

To prevent two pages from modifying in-process Session variables at the same time, the ASP.NET runtime uses a lock. When a request arrives for a page that reads and writes Session variables, the runtime acquires a writer lock. The writer lock will block other pages in the same Session who might write to the same session variables.

Emphasis mine.

To mitigate this, you can enable or disable session state for individual pages, or declare your usage of session state as "read only".

Pay attention not to accidentally choose the wrong type of session state, however (enabled, disabled, read only). It needs to be set correctly for your application to work correctly.

rohit singh

Since the ReportViewer user's session state continously, it uses a lock that blocks page loading.The method which i followed to solve my problem is :

  • Create a Class and implement IReportServerConnection2 interface
  • add key="ReportViewerServerConnection" value="MyNamespace.MyClass, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 00000000000000000 "/> to web.config file in <appsettings>
  • Set EnableSessionState = "Readonly" at the ReportViewer.aspx page

This thread helped me in solving my issue : The attempt to connect to the report server failed - Setting URL and Path in ASP.NET?

Can you try ?

System.Threading.Thread thLoadReport = new System.Threading.Thread(new System.Threading.ThreadStart(LoadReport));
thLoadReport.Start();

private void LoadReport()
{
    // Invoke necessary controls here for eg.
    mainReportViewer.Invoke((MethodInvoker)delegate {
        // your report loading here
    });
}

Let me know if you need more help with this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!