无法加载文件或程序集 Microsoft.ReportViewer.WebForms.XmlSerializers

8

我将在我的aspx页面中使用ReportViewer控件。我正在远程处理模式下访问报告。

这是我的代码:

      ReportServerDomain = System.Configuration.ConfigurationSettings.AppSettings["ReportServerDomain"];

       ReportServerUserName = System.Configuration.ConfigurationSettings.AppSettings["ReportServerUserName"];

       ReportServerPassword = System.Configuration.ConfigurationSettings.AppSettings["ReportServerPassword"];

       String ReportFolder = System.Configuration.ConfigurationSettings.AppSettings["ReportFolderName"];

       rptUrl = new Uri(Convert.ToString(System.Configuration.ConfigurationSettings.AppSettings["ReportURL"]));

       IReportServerCredentials irsc = new CustomReportCredentialsToCreateStatement(ReportServerUserName, ReportServerPassword, ReportServerDomain);

       ReportViewer1.ServerReport.ReportServerCredentials = irsc;     

       ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

       parameters = new ReportParameter[1];

       parameters[0] = new ReportParameter("ClientStatementBatchId", ds.Tables["ClientStatemtntBatch"].Rows[0]["ClientStatementBatchID"].ToString());

       ReportViewer1.ServerReport.ReportServerUrl = rptUrl;

       ReportViewer1.ServerReport.ReportPath = "/" + ReportFolder + "/Client Statements";


       ReportViewer1.ServerReport.SetParameters(parameters);    // i am getting error on this line.

       ReportViewer1.ServerReport.Refresh();

错误信息如下:

无法加载文件或程序集'Microsoft.ReportViewer.WebForms.XmlSerializers, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'或其依赖项之一。系统找不到指定的文件。

请问有人能帮我解决这个问题吗?
谢谢,
D.Bernardin

请在 Stack Overflow 上检查此问题及所有答案:https://dev59.com/Z1LTa4cB1Zd3GeqPbIaN - Davide Piras
2个回答

16

0

这个问题的根本原因是 Microsft.ReportViewer.Webforms dll 的版本问题。解决方案是从位置 http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6576 下载并运行 exe ReportViewer.exe。 我们实际的问题是我们的报告相关的 dll 指向了一些旧版本,即不是 11.0.0.0 版本。一旦该 exe 正确运行,它将正确地指向版本 11.0.0.0。 为了使其正常工作,在 web 配置中进行相同的条目输入。

<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, 
Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>" 

以及注册区域也

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接