C# 共享主机上的Crystal报告加载失败

C# 共享主机上的Crystal报告加载失败,c#,asp.net,crystal-reports,C#,Asp.net,Crystal Reports,我正在使用asp.NETC开发一个web应用程序。我设计了一个crystal报表,一旦用户从web应用程序购买了一个项目,它将从数据库中获取账单详细信息 在我的本地系统中,一切正常。但是,当我把我的发布文件夹上传到我的共享托管区时,我就面临这个错误 System.Runtime.InteropServices.COMException:文件名无效 下面是我在.cs文件中返回的代码 generatereport(6,Server.MapPath("~/CustomerPurchaseBill.rp

我正在使用asp.NETC开发一个web应用程序。我设计了一个crystal报表,一旦用户从web应用程序购买了一个项目,它将从数据库中获取账单详细信息

在我的本地系统中,一切正常。但是,当我把我的发布文件夹上传到我的共享托管区时,我就面临这个错误

System.Runtime.InteropServices.COMException:文件名无效

下面是我在.cs文件中返回的代码

generatereport(6,Server.MapPath("~/CustomerPurchaseBill.rpt");

public void generatereport(int trid, string filepath)
{
        ReportTableAdapters.ReporttblAdap dp = new ReportTableAdapters.ReporttblAdap();
        ReportDocument rdc = new ReportDocument();
        DataTable tb = new DataTable();
        tb = dp.GetData(trid);            
        rdc.Load(filepath);
        rdc.SetDataSource(tb);
        rdc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport");
        //CrystalReportViewer2.ReportSource = rdc; 
}

这篇文章可能会帮助你嗨,我检查了你建议的链接,并尝试进行链接中建议的更改,但发布后我的错误仍然是一样的。这似乎是一些权限问题,请尝试让每个人都能完全访问windows临时目录。也许能解决你的问题。