【发布时间】:2018-09-12 23:13:43
【问题描述】:
我们有一个用 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 文件流。
【问题讨论】:
标签: .net deployment crystal-reports