我们有一个用 c# (Visual Studio 2015) 编写的 ASP.NET 项目。作为应用程序的一部分,我们包含了一些在 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 文件流。
我从本地机器复制了 log4net.dll 以克服第一个错误。显然,您还需要安装一个水晶运行时。但是运行时不会安装在 Windows 2008 r2 SP1 服务器上。注册某些 DLL 时失败。
我们能够获取旧版本 (CRRuntime_32bit_13_0_19) 进行安装。但这与编译的代码有问题。
我需要应用一些 Microsoft 更新才能最终安装 CRRuntime_32bit_13_0_23 运行时。安装此运行时后,一切正常。
文档不是很清楚。似乎也没有任何简单的方法可以找到正确运行时的先决条件列表。我不知道需要哪个 MS 更新。我刚安装了一堆。该服务器在此之前已锁定更新,因为它已经稳定了好几年。
学过的知识。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句