报表查看器间歇性未加载

时间:2019-01-26 18:32:25

标签: reportviewer reportviewerformvc

我已经跟随链接https://github.com/dhana29/ReportViewer-control-to-replace-iFrame-on-MVC-Project来创建reportViewer并在我的ASP.net MVC 5应用程序中显示报告。在我的开发环境中一切正常。

当我将代码推送到产品服务器时。 reportviewer有时会加载数据,有时会立即加载数据,当它不加载Report not loaded

时,我会看到以下屏幕

产品具有两台服务器,并且都在单个负载均衡器下。

这是我在.aspx页面g中的控件

        <rsweb:ReportViewer id="reportViewer1" runat ="server" ShowPrintButton="false"  Width="99.9%" Height="100%" AsyncRendering="true" ZoomMode="Percent" 
            KeepSessionAlive="true" SizeToReportContent="false" ></rsweb:ReportViewer>  

在.cs页中:

public partial class ReportViewer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string reportPath = Request["reportPath"];
                ReportServerCredentials reportServerCredentials = new ReportServerCredentials(
                    System.Configuration.ConfigurationManager.AppSettings["SSRSUserName"],
                    System.Configuration.ConfigurationManager.AppSettings["SSRSPassword"],
                    System.Configuration.ConfigurationManager.AppSettings["SSRSDomain"]);
                reportViewer1.ProcessingMode = ProcessingMode.Remote;
                reportViewer1.ServerReport.ReportPath = reportPath;
                reportViewer1.ServerReport.ReportServerUrl = new Uri(System.Configuration.ConfigurationManager.AppSettings["SSRSUrl"]);
                reportViewer1.ServerReport.ReportServerCredentials = reportServerCredentials;
                reportViewer1.AsyncRendering = false;
                reportViewer1.KeepSessionAlive = true;

                reportViewer1.ShowZoomControl = false;
                reportViewer1.ShowFindControls = false;
                reportViewer1.ShowPrintButton = false;
                reportViewer1.ShowWaitControlCancelLink = false;
                reportViewer1.ShowBackButton = false;

                reportViewer1.SizeToReportContent = true;
                reportViewer1.ZoomMode = ZoomMode.FullPage;
                reportViewer1.Width = Unit.Percentage(100);
                reportViewer1.Height = Unit.Percentage(100);

                reportViewer1.ServerReport.Refresh();
            }
            catch (Exception ex)
            {

            }
        }
    }
}

有人可以告诉我解决方案吗?

0 个答案:

没有答案