负载报告没有在服务器 - 水晶报表 [英] Load Report Failed On Server - Crystal Reports

查看:79
本文介绍了负载报告没有在服务器 - 水晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示的报告非常清楚我的桌面开发计算机上的水晶报表查看器页面。我已经使用这个浏览器页面的code是:

I have a crystal report viewer page that displays a report perfectly well on my desktop development computer. The code I have used for this viewer page is:

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LoyalitySystem;
using System.Configuration;
using HQ.DatabaseGateway;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.IO;

public partial class WebPages_DynamicReports_CrystalReportViewerPage : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string reportPath = Server.MapPath((string)Utils.GetSessionNavigator(this).GetDataFromCurrentPage(PageParams.Reports.Report));
        ReportDocument rep = new ReportDocument();

        try
        {
            if (!File.Exists(reportPath))
            {
                Response.Write("The specified report does not exist \n");
            }

            rep.Load(reportPath);
            LoadReport(rep);
            this.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
            this.CrystalReportViewer1.HasToggleGroupTreeButton = false;
            this.CrystalReportViewer1.ReportSource = rep;
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }

    private bool LoadReport(ReportDocument doc)
    {
        TableLogOnInfo crTableLogonInfo;
        Sections crSections;
        Database crDatabase;
        Tables crTables;
        ReportDocument crSubreportDocument;
        ReportObjects crReportObjects;
        SubreportObject crSubreportObject;

        try
        {
            ConnectionInfo con = new ConnectionInfo();
            con.ServerName = ConfigurationManager.AppSettings["dbsource"];
            con.DatabaseName = Utils.GetSessionNavigator(this).UserData.DatabaseName;
            con.UserID = ConfigurationManager.AppSettings["uid"];
            con.Password = ConfigurationManager.AppSettings["pwd"];
            crDatabase = doc.Database;
            crTables = crDatabase.Tables;

            //loop through all the tables and pass in the connection info
            foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
            {
                crTableLogonInfo = crTable.LogOnInfo;
                crTableLogonInfo.ConnectionInfo = con;
                crTable.ApplyLogOnInfo(crTableLogonInfo);
            }

            // set the crSections object to the current report's sections
            crSections = doc.ReportDefinition.Sections;

            // loop through all the sections to find all the report objects
            foreach (Section crSection in crSections)
            {
                crReportObjects = crSection.ReportObjects;
                // loop through all the report objects to find all the subreports
                foreach (ReportObject crReportObject in crReportObjects)
                {
                    if (crReportObject.Kind == ReportObjectKind.SubreportObject)
                    {
                        crSubreportObject = (SubreportObject)crReportObject;

                        // open the subreport object
                        crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);

                        // set the database and tables objects to work with the subreport
                        crDatabase = crSubreportDocument.Database;
                        crTables = crDatabase.Tables;

                        // loop through all the tables in the subreport and 
                        // set up the connection info and apply it to the tables
                        foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
                        {
                            crTableLogonInfo = crTable.LogOnInfo;
                            crTableLogonInfo.ConnectionInfo = con;
                            crTable.ApplyLogOnInfo(crTableLogonInfo);
                        }
                    }
                }
            }
        }
        catch (Exception e)
        {
            Response.Write(e.Message);
            return false;
        }

        return true;
    }
}

由于previously说,这工作得很好,当本地主机我的应用程序,但在生产服务器上我得到负载报告没有对每一个我运行报告,并从我的检查,以查看文件是否存在,我可以看到该请求的文件被发现。

As previously stated, this works fine when locally hosting my application, but on the production server I am getting Load Report Failed on every report that I run, and from my check to see if the file exists, I can see that the requested file is being found.

我的.aspx标记是:

My .aspx markup is:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CrystalReportViewerPage.aspx.cs"
    Inherits="WebPages_DynamicReports_CrystalReportViewerPage" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="cr" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CrystalReportViewer</title>
</head>
<body>
    <form id="form1" runat="server">
    <cr:CrystalReportViewer ID="CrystalReportViewer1" runat="server" HasCrystalLogo="False" />
    </form>
</body>
</html>

我的web.config文件包含:

My web.config file contains:

    <sectionGroup name="businessObjects">
        <sectionGroup name="crystalReports">
            <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null"/>
        </sectionGroup>
    </sectionGroup>

        <assemblies>
            <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
            <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        </assemblies>
        <buildProviders>
            <add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        </buildProviders>

和我已经安装了 CRforVS_redist_install_64bit_13_0_2 CRforVS_redist_install_32bit_13_0_2 再发行在不同时期,都在我的Windows 2008 R2数据中心服务器上都未能解决问题。应用程序连接到一个Amazon RDS SQL Server实例,是在Amazon EC2实例本身。

And I have installed both CRforVS_redist_install_64bit_13_0_2 and CRforVS_redist_install_32bit_13_0_2 redistributables on my Windows 2008 R2 Datacenter server at different times and both have failed to resolve the issue. The application connects to an Amazon RDS SQL Server Instance, being on an Amazon EC2 instance itself.

我搜索在互联网上一段时间,找到这个问题的解决方法,但显然加载报告失败的消息在其含义比较宽泛,所以我希望我能对这个特定实例帮助解决这个问题的问题。

I've searched over the internet for some time to find the solution for this issue but apparently the Load Report Failed message is quite broad in its meaning, so I hope that I can solve this problem with help towards this particular instance of the issue.

我一直坚持这个问题超过现在一个星期,所以我将不胜感激,如果任何帮助可以提供。

I have been stuck with this issue for over a week now so I would be grateful if any help can be offered.

推荐答案

此消息通常表明报表不可使用所提供的路径。如果运行时未安装,您将收到不同message.In你的情况一切都正确安装,但该报告没有reportPath + rpName可用。您可以调试,并检查了reportPath + rpName指向,如果报告真的存在。尝试使用Path.Combine(reportPath,rpName) - 如果必要,将增加\\。还要检查IIS是否有权限访问的文件夹reportPath的报告。

This message usually shows that the report is not available using the provided path. If runtime is not installed you will receive different message.In your case everything is installed correctly but the report is not available in reportPath + rpName. You can debug and check were reportPath + rpName is pointing and if the report is really there. Try to use Path.Combine( reportPath , rpName) - it will add \ if necessary. Also check if IIS has permission to access the reports in reportPath folder.

这篇关于负载报告没有在服务器 - 水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆