部署到IIS服务器后,不会显示RDLC报告它在我正在开发应用程序的同一系统上工作

问题描述

在IIS Server上发布站点后,没有显示

RDLC报告。 如果我在与开发应用程序相同的系统上发布,那么它就会显示出来。

前端asp.net代码如下:

private void BindReport(string ReportPath,DataTable Table)
{
    this.ReportViewer1.LocalReport.ReportPath = ReportPath;
    this.ReportViewer1.LocalReport.DataSources.Clear();
    this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1",Table));
    if (ReportPath != "Reports\\InformationReports\\MembersMailingLabels.rdlc")
        this.ReportViewer1.LocalReport.SetParameters(new ReportParameter("CompanyName",SystemConfig.GetSystemKeyValue("ClientNameAr",false)));
    this.ReportViewer1.LocalReport.Refresh();
}

后端代码如下:

An error occurred during local report processing. When Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession ()
 When Microsoft.Reporting.WebForms.LocalReport.SetParameters (IEnumerable`1 parameters)
 When MembersDataReport.BindReport (String ReportPath,DataTable Table) in D: \ PublishedWebsite \ asd \ \ InformationReports \ MembersDataReport.aspx.cs: Line 174
 when MembersDataReport.GetData () in D: \ PublishedWebsite \ asd \ Reports \ InformationReports \ MembersDataReport.aspx.cs: Line 144
 at MembersDataReport.btnSearch_Click (Object sender,EventArgs e) in D: \ PublishedWebsite \ asd \ Reports \ InformationReports \ MembersDataReport.aspx.cs: Line 87
 at System.Web.UI.WebControls.Button.OnClick (EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent (String eventArgument) at System .Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint) The definition of the report 'Reports \ InformationReports \ MembersDataReport.rdlc' is invalid. When Microsoft.Reporting.ReportCompiler.CompileReport (ICatalogItemContext,Byte [] reportDefinition,Boolean generateExpressionHostWithRefusedPermissions,ControlSnapshot & snapshot) (When Microsoft.Reporting.LocalService.GetCompiledReportService.GetCompiledReport),Microsoft.Reporting.LocalService.GetCompiledReport (PreviewItemContext. ) When Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession () an unexpected error occurred in Report Processing. When Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat (PublishingContext reportPublishingContext) When Microsoft.Reporting.ReportCompiler.CompileReport (ICatalogItemContext context,Byte [] ReportDefinition,BooleanExpress & GenerationHostWithRithRefusedPermissions,the Microsoft ReportDefinition,BooleanExpress & generateHostWithRithRefusedPermissions could not load Microsoft.Reporting. = 14.0.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91 'or one of its dependencies. The system cannot find the file specified. On Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatWriter.Write (Object obj,Boolean verify,Boolean assertOnInvalidType) When Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.ReportIntermediateFormat.Persistence.IntermediateFormatWriter. At Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat (Stream definitionStream,String & description,String & language,ParameterInfoCollection & parameters,DataSourceInfoCollection & dataSources,DataSetInfoCollection & sharedDataSetReferences,An error occurred during local report processing. When Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession () When Microsoft.Reporting.WebForms.LocalReport.SetParameters (IEnumerable`1 parameters) When MembersDataReport.BindReport (String ReportPath,DataTable Table) in D: \ PublishedWebsite \ asd \ \ InformationReports \ MembersDataReport.aspx.cs: Line 174 when MembersDataReport.GetData () in D: \ PublishedWebsite \ asd \ Reports \ InformationReports \ MembersDataReport.aspx.cs: Line 144 at MembersDataReport.btnSearch_Click (Object sender,EventArgs e) in D: \ PublishedWebsite \ asd \ Reports \ InformationReports \ MembersDataReport.aspx.cs: Line 87 at System.Web.UI.WebControls.Button.OnClick (EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent (String eventArgument) at System .Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint,

从事件日志中获得以下异常:

parent component

解决方法

确保所有与RDLC相关的文件都在发布的文件中。如果不存在,请从Project文件中复制并粘贴。您可以尝试以下步骤。

  • 将.rdlc文件夹复制到项目目录中的bin文件夹。
  • 再次将项目部署到服务器。
,

除了确保文件实际在服务器上之外,还应该使用HttpServerUtility.MapPath在ASP.NET中正确映射路径。

// Assuming ReportPath is something like '/Reports/MyReport.rdlc'
this.ReportViewer1.LocalReport.ReportPath = HttpContext.Current.Server.MapPath(ReportPath);

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...