c# – .Net应用程序,水晶报告无法在共享主机中使用
作者:互联网
我有一个使用水晶报告的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");
报告下载在localhost中工作正常.但是当我在Godaddy的共享主机中托管这个应用程序时,给出以下屏幕
解决方法:
Godaddy的共享主机不支持Crystal报告.
不仅Godaddy的共享主机,而且大多数主机提供商的共享主机不支持
水晶报道.要使用Crystal报表,您必须购买VPS或专用服务器.
如果要在服务器上运行Crystal报表,则始终需要该服务器上的Crystal报表运行时.
GoDaddy的共享托管服务器使用不支持的默认中等信任级别
Crystal报表运行时的insatllation.
有用的信息 :
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,net,asp-net,asp-net-mvc,crystal-reports 来源: https://codeday.me/bug/20190611/1216598.html