How to solve “Load Report Failed” in ASP.Net?

2019-08-16 13:31发布

I have one remote server (ex: 192.168.8.8) and one local server. I can run the crystal report which is on my local server without any issue.

But When I try to run on my remote server, it throws Load Report Failed error.

Here is my code:

CrystalReport.cs

protected void CrystalReportViewer1_Init(object sender, EventArgs e)
    {
        ReportDocument _rdStudents = new ReportDocument();
        string reportPath = Server.MapPath("~" + Request.QueryString["filename"].ToString());
        //string reportPath = Request.QueryString["filename"].ToString();
        _rdStudents.Load(reportPath);
        CrystalReportViewer1.ReportSource = _rdStudents;
    }

CrystalReport.aspx

<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="js/jquery-3.1.1.js"></script>
    <title></title>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" Height="962px" ToolbarImagesFolderUrl="" ToolPanelWidth="200px" Width="1344px"  HasRefreshButton="True" ToolPanelView="ParameterPanel" OnInit="CrystalReportViewer1_Init" />

    </div>
    </form>
</body>
</html>

My report location is //192.168.8.8/c$/inetpub/wwwroot/CrystalReportFiles/Test/Report1.rpt

I check with this crystal-reports-load-report-failed-error-running-report-on-the-server link.

I will not run the report directly using Report FileName attribute.

I tried with both category

string reportPath = Server.MapPath("~" + Request.QueryString["filename"].ToString());  //filename = /CrystalReportFiles/Test/Report1.rpt

string reportPath = Request.QueryString["filename"].ToString();  //filename=//192.168.8.8/c$/inetpub/wwwroot/CrystalReportFiles/Test/Report1.rpt

I gave access to c:\Windows\Temp to full control access for (IIS_IUSRS, USERS, Everyone)

I installed CRforVS_13_0_20

Update

  1. I have CrystalReport.aspx file on my remote server also and my local server also

  2. By passing parameter of file path(//192.168.8.8/c$/inetpub/wwwroot/CrystalReportFiles/Test/Report1.rpt) to CrystalReport.aspx (local server). I can run report

  3. But I cannot run from CrystalReport.aspx which is on RemoteServer(192.168.8.8), by passing the same path

0条回答
登录 后发表回答