部署到IIS时无法运行CrystalReports

问题描述 投票:0回答:2

我们在c#中有一个ASP.NET项目(Visual Studio 2015)。作为应用程序的一部分,我们在VS 2015的Crystal插件中包含了几个固定的Crystal Reports。在本地开发机器上,我们可以使用下面的代码运行报告没问题。

using CrystalDecisions.CrystalReports.Engine;
...
ReportDocument report = new ReportDocument();
TableLogOnInfo conInfo = new TableLogOnInfo();
conInfo.ConnectionInfo.UserID = Global.Config.GetValue("USERID");
conInfo.ConnectionInfo.Password = Global.Config.GetValue("PASSWORD");
conInfo.ConnectionInfo.DatabaseName = Global.Config.GetValue("DATABASENAME");
conInfo.ConnectionInfo.ServerName = Global.Config.GetValue("DATASOURCE");

report.Load(reportPath + name);
for (int i = 0; i < report.Database.Tables.Count; i++)
{
    report.Database.Tables[i].ApplyLogOnInfo(conInfo);
}

return new FileStreamResult(report.ExportToStream(ExportFormatType.PortableDocFormat), "application/pdf");

但是当我们在Windows 2008 Server r2计算机上部署到IIS服务器时,我们在实例化ReportDocument对象时收到错误:

at CrystalDecisions.Shared.SharedUtils..cctor() : 
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

所有CrystalDecisions。*。dll都包含在已发布的应用程序中。我拉着我的头发试图找出问题所在。

为了清楚起见,我们没有使用Crystal Viewer。我们只是尝试运行报告(* .rpt)并输出到PDF文件流。

.net deployment crystal-reports
2个回答
0
投票

听起来它与Crystal Reports无关。

您需要部署log4net库。可能是您的应用程序使用它来注册日志(如异常事件)。


0
投票

我从本地计算机复制了log4net.dll以解决第一个错误。显然,您还需要安装Crystal运行时。但运行时不会安装在Windows 2008 r2 SP1服务器上。注册某些DLL时失败了。

我们能够安装旧版本(CRRuntime_32bit_13_0_19)。但这与编译的代码有问题。

我需要应用一些Microsoft更新才能最终安装CRRuntime_32bit_13_0_23运行时。一旦安装了这个运行时,一切都很好。

文档不是很清楚。似乎也没有任何简单的方法来查找正确运行时的先决条件列表。我不知道需要哪个MS更新。我刚安装了一堆。此服务器在此之前已被锁定为更新,因为它已稳定了好几年。

学过的知识。

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