c# - 带有 Crystal Report 的 .Net 应用程序无法在共享主机中运行

标签 c# asp.net .net asp.net-mvc crystal-reports

我有一个使用 Crystal 报表的 MVC 应用程序。我使用以下代码下载报告,

 ReportDocument rd = new ReportDocument();
 rd.Load(Path.Combine(Server.MapPath("~/Reports/" + Session["rpt"])));
 rd.SetDataSource(Session["result"]);
 Response.Buffer = false;
 Response.ClearContent();
 Response.ClearHeaders();
 //Excel
 Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
 stream.Seek(0, SeekOrigin.Begin);
 return File(stream, "application/vnd.ms-excel", "Cheque.xls");

报告下载在本地主机上运行良好。但是当我在 Godaddy 的共享主机中托管这个应用程序时,会出现以下屏幕 enter image description here

最佳答案

Godaddy 的共享主机不支持 Crystal 报表。 不仅是Godaddy的共享主机,大部分主机商的共享主机也不支持 Crystal 报表。要使用 Crystal 报表,您必须购买 VPS 或专用服务器。

如果要在服务器上运行 Crystal 报表,则始终需要该服务器上的 Crystal 报表运行时。 GoDaddy 的共享主机服务器使用默认的中等信任级别,不支持 Crystal 报表运行时的安装。

有用信息:

GoDaddy's shared hosting servers use the default Medium trust level with the addition of OleDbPermission, OdbcPermission, and a less-restrictive WebPermission.

Applications operating under a Medium trust level have no registry access, no access to the Windows event log, and cannot use reflection. Such applications can communicate only with a defined range of network addresses and file system access is limited to the application's virtual directory hierarchy. Please make sure that your application can work in a Medium trust environment if you are having any problems with it.

因此人们可以将其用作共享托管权限的一般指示。

支持 Crystal Report 的共享主机之一是 http://asphostportal.com .我不确定这一点。 我从其他社区获得了这些信息。

关于c# - 带有 Crystal Report 的 .Net 应用程序无法在共享主机中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47545523/

相关文章:

.net - Visual Studio中的源文件编码(VS2005,但可以应用于其他版本)

c# - 为什么 Xamarin android Designer 在打开 *.axml 文件时不显示在 visual studio 2012 中

c# - 开源 Winforms 应用程序?

从 android 提交时,Asp.net 页面无法读取 Http Post 数据

android - 用于 ADFS 移动身份验证的 Azure ACS 替代方案

c# - 直接解析子串为double

c# - 有没有办法获取 System.Random 的实际状态?

c# - Windows 7 C# 中的音量控制

c# - 如果不支持包含,如何在 LINQ to Entities( Entity Framework )中执行 SQL 样式 'IN' 语句?

c# - token 解密 RSA 适用于本地主机但不适用于服务器