的ReportViewer是阻止其他functionalites直到报表浏览器的加载完成 [英] ReportViewer is blocking other functionalites until the loading of report viewer is completed

查看:250
本文介绍了的ReportViewer是阻止其他functionalites直到报表浏览器的加载完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是ReportViewer控件:

 <形式ID =reportForm=服务器>
    < ASP:ScriptManager的ID =ScriptManager1=服务器AsyncPostBackTimeout =360000>
    < / ASP:ScriptManager的>
    < D​​IV>
      < rsweb:的ReportViewer ID =mainReportViewer=服务器WIDTH =100%
            高度=100%SizeToReportContent =真>
      < / rsweb:的ReportViewer>
    < / DIV>
  < /形式GT;
 

这是隐藏页的code:

 保护无效的Page_Load(对象发件人,EventArgs的)
{
    如果(会话[的UserInfo] == NULL)
    {
        的Response.Redirect(〜/帐号/登录,真正的);
    }
    字符串ReportPath =;
    尝试
    {
        如果(mainReportViewer.Page.IsPostBack)回报;

        mainReportViewer.ProcessingMode = ProcessingMode.Remote;

        mainReportViewer.ServerReport.ReportServerUrl =新的URI(
            @+ ConfigurationManager.AppSettings [的ReportServer。的ToString()
        );
        ReportPath = Convert.ToString(ConfigurationManager.AppSettings [ReportPath]);
        如果(!string.IsNullOrEmpty(ReportPath))
        {
            如果(ReportPath.Substring(0,1)==/)
            {
                ReportPath = ReportPath.Substring(1,ReportPath.Length  -  1);
            }
            如果(ReportPath.Substring(ReportPath.Length! -  1,1)=/)
            {
                ReportPath = ReportPath +'/';
            }
        }
        其他
        {
            ReportPath =;
        }
        ReportPath = ReportPath +请求[报告]的ToString()斯普利特(ToCharArray()。)[0]的ToString()。
        mainReportViewer.ServerReport.ReportPath = @/+ ReportPath;

        ReportParameterCollection parmCol =新ReportParameterCollection();
        字符串sFrom =;
        字符串STO =;
        字符串DATERANGE =请求[DATERANGE]的ToString()。
        字符串[] OBJ = dateRange.Split( - ToCharArray());
        如果(obj.Length→1)
        {
            sFrom =物镜[0]的ToString();
            STO = OBJ [1]的ToString();
        }
        其他
            sFrom =物镜[0]的ToString();
        否则,如果(请求[报告。toString()方法。ToUpper的()==SOURCEWISEREPORT_AR.RDL)
        {
            串[] frommonthyear = sFrom.Split(,);
            串[] tomonthyear = sTo.Split(,);

            parmCol.Add(新ReportParameter(FromYear,frommonthyear [1]));
            parmCol.Add(新ReportParameter(FromMonth,frommonthyear [0]));
            parmCol.Add(新ReportParameter(ToYear,tomonthyear [1]));
            parmCol.Add(新ReportParameter(ToMonth,tomonthyear [0]));
            parmCol.Add(新ReportParameter(郎,Convert.ToString(会话[文化])));
        }
        mainReportViewer.PromptAreaCollapsed = TRUE;
        mainReportViewer.AsyncRendering = TRUE;
        mainReportViewer.ServerReport.Timeout = System.Threading.Timeout.Infinite;
        mainReportViewer.ServerReport.SetParameters(parmCol);
        mainReportViewer.ShowParameterPrompts = TRUE;
        mainReportViewer.LocalReport.EnableHyperlinks = TRUE;
        mainReportViewer.ServerReport.Refresh();
    }
    赶上(例外前)
    {
        CommonFunctions.createLog(报告:+ ex.Message);
    }
}
 

当我尝试查看报告(这是在asp.net mvc的一个视图)在一个新的标签来查看报告(这是与codeFile的aspx页面)打开和平均,而如果我尝试打开任何从previous标签的页面不会被加载,直到在新标签页的报告是完全加载链接。我试图做的一切,但没有找到解决办法还。需要帮助

解决方案
  

的意思而如果我尝试打开由previous标签的页面不会被加载,直到在新标签页中报告中的任何链接是完全加载

您需要分析应用程序。最有可能您的请求已被排队试图获得一个写锁定了用户的会话状态。

您可以了解更多有关该问题的<一个href="http://odeto$c$c.com/Blogs/scott/archive/2006/05/21/session-state-uses-a-reader-writer-lock.aspx">here:

  

要prevent从在同一时间修改过程中的Session变量两页时,ASP.NET运行时使用的锁。当一个请求到达一个网页,读取和写入会话变量,在运行时获得一个作家锁。 作家锁将阻止在同一会话中其他网页谁可能写入同一个会话变量。

重点煤矿。

要缓解这种,您可以启用或禁用会话状态的单个页面,或者宣布您的使用情况会话状态为只读

要格外注意避免无意中选择了错误类型的会话状态,但是(启用,禁用,只读)。它需要正确设置你的应用程序能够正常工作。

This is the ReportViewer control:

  <form id="reportForm" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="360000">
    </asp:ScriptManager>
    <div>
      <rsweb:ReportViewer ID="mainReportViewer" runat="server" Width="100%" 
            Height="100%" SizeToReportContent="True"  >
      </rsweb:ReportViewer>
    </div>
  </form>

This is the code behind page:

protected void Page_Load(object sender, EventArgs e)
{
    if (Session["UserInfo"] == null)
    {
        Response.Redirect("~/account/login", true);
    }
    string ReportPath = "";
    try
    {
        if (mainReportViewer.Page.IsPostBack) return;

        mainReportViewer.ProcessingMode = ProcessingMode.Remote;

        mainReportViewer.ServerReport.ReportServerUrl = new Uri(
            @"" + ConfigurationManager.AppSettings["ReportServer"].ToString()
        );
        ReportPath = Convert.ToString(ConfigurationManager.AppSettings["ReportPath"]);
        if (!string.IsNullOrEmpty(ReportPath))
        {
            if (ReportPath.Substring(0, 1) == "/")
            {
                ReportPath = ReportPath.Substring(1, ReportPath.Length - 1);
            }
            if (ReportPath.Substring(ReportPath.Length - 1, 1) != "/")
            {
                ReportPath = ReportPath + '/';
            }
        }
        else
        {
            ReportPath = "";
        }
        ReportPath = ReportPath + Request["Report"].ToString().Split(".".ToCharArray())[0].ToString();
        mainReportViewer.ServerReport.ReportPath = @"/" + ReportPath;

        ReportParameterCollection parmCol = new ReportParameterCollection();
        string sFrom = "";
        string sTo = "";
        string dateRange = Request["dateRange"].ToString();
        string[] obj = dateRange.Split("-".ToCharArray());
        if (obj.Length > 1)
        {
            sFrom = obj[0].ToString();
            sTo = obj[1].ToString();
        }
        else
            sFrom = obj[0].ToString();
        else if (Request["Report"].ToString().ToUpper() == "SOURCEWISEREPORT_AR.RDL")
        {
            string[] frommonthyear = sFrom.Split(',');
            string[] tomonthyear = sTo.Split(',');

            parmCol.Add(new ReportParameter("FromYear", frommonthyear[1]));
            parmCol.Add(new ReportParameter("FromMonth", frommonthyear[0]));
            parmCol.Add(new ReportParameter("ToYear", tomonthyear[1]));
            parmCol.Add(new ReportParameter("ToMonth", tomonthyear[0]));
            parmCol.Add(new ReportParameter("lang", Convert.ToString(Session["Culture"])));
        }
        mainReportViewer.PromptAreaCollapsed = true;
        mainReportViewer.AsyncRendering = true;
        mainReportViewer.ServerReport.Timeout = System.Threading.Timeout.Infinite;
        mainReportViewer.ServerReport.SetParameters(parmCol);
        mainReportViewer.ShowParameterPrompts = true;
        mainReportViewer.LocalReport.EnableHyperlinks = true;
        mainReportViewer.ServerReport.Refresh();
    }
    catch (Exception ex)
    {
        CommonFunctions.createLog("Reports : " + ex.Message);
    }
}

When I try to view report(which is a view in asp.net mvc) it opens in a new tab to view the report (which is aspx page with codefile) and 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. I tried doing everything but no solution found yet. Need help

解决方案

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.

这篇关于的ReportViewer是阻止其他functionalites直到报表浏览器的加载完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆