SSRS MVC-仅显示空白页

问题描述 投票:1回答:1

我在MVC 4中有一个SSRS报告。运行时显示空白页。 但是当我没有显示任何错误时,我的输出页面为空白,有人可以帮我吗?

我的Report.aspx页是

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" 
    Inherits="Budget.Reports.Report" %>

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, 
    Culture=neutral, PublicKeyToken=89845dcd8080cc91" 
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" ZoomMode="PageWidth" SizeToReportContent="true">

    <LocalReport ReportPath="Report3.rdlc">

    </LocalReport>


    </rsweb:ReportViewer>

    </div>

    </form>
    </body>
    </html>

我的Report.aspx.cs页是

protected void Page_Load(object sender, EventArgs e)
        {
            BudgetModel bModel = new BudgetModel();

             this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;



             this.ReportViewer1.LocalReport.ReportPath = Path.Combine(Server.MapPath("~/Reports"), "Report3.rdlc");


             BudgetDataSet DataSet1 = new BudgetDataSet();

                IEnumerable<BudgetVM> reportDetails = bModel.getBudgetDetails("xxxxxx");

                ReportDataSource reportDataSource = new ReportDataSource("DataSet1", reportDetails);

                LocalReport localReport = new LocalReport();
                localReport.DataSources.Add(reportDataSource);
                string reportType = "PDF";
                string mimeType;
                string encoding;
                string fileNameExtension;


                string deviceInfo =
                "<DeviceInfo>" +
                "  <OutputFormat>PDF</OutputFormat>" +
                "  <PageWidth>8.5in</PageWidth>" +
                "  <PageHeight>11in</PageHeight>" +
                "  <MarginTop>0.5in</MarginTop>" +
                "  <MarginLeft>1in</MarginLeft>" +
                "  <MarginRight>1in</MarginRight>" +
                "  <MarginBottom>0.5in</MarginBottom>" +
                "</DeviceInfo>";

                Warning[] warnings;
                string[] streams;
                byte[] renderedBytes;

                BudgetVM report = new BudgetVM();

                foreach (var r_item in reportDetails)
                {
                   // report.DIVDESC = r_item.DIVDESC;



                    ReportParameter[] parameters = new ReportParameter[3];
                    parameters[0] = new ReportParameter("DIVDESC", r_item.DIVDESC);
                    parameters[1] = new ReportParameter("AREA", r_item.AREA);
                    parameters[2] = new ReportParameter("STATEDESC", r_item.STATEDESC);


                    this.ReportViewer1.LocalReport.SetParameters(parameters);
                }
                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.DataSources.Add(reportDataSource);
                    ReportViewer1.LocalReport.Refresh();

                }

我在MVC 4中有一个SSRS报告。运行时显示空白页。 但是当我没有显示任何错误时,我的输出页面为空白,有人可以帮我吗?

asp.net-mvc ssrs-2008
1个回答
0
投票

TL; DR;

问题来自

this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

很久以前,我面临着同样的问题。 我仍然记得这让我发疯了几天。 幸运的是,我发现了将SQL Server Reporting Services与ASP.NET 3.5集成的文章。

您还可以找到该作者关于ProccessingMode的评论。 让我在这里引用以供参考

在此处输入图片说明

希望它有用。

© www.soinside.com 2019 - 2024. All rights reserved.