【问题标题】:Load report failed in web site using Crystal Reports使用 Crystal Reports 在网站中加载报告失败
【发布时间】:2014-10-16 07:13:59
【问题描述】:

我开发了一个网站,并在我的网站中放置了一些 *.rpt 文件。我在部署机器(版本 13.0.0.99)上使用 Crystal Report 运行时引擎。这里有 Windows Server 2008 R2 企业版。

然后,当我将应用程序添加到 IIS 并浏览它时,我收到错误“加载报告失败”,即使没有使用 Crystal 报告的网页也没有任何显示。每次刷新时报告或 *.rpt 文件的名称都会更改,所有报告名称都会显示出来,并且错误页面上有多行,包括奇怪的字符。

这是错误页面的截图:

编辑 1:

检查Temp文件夹的权限后,除了包含Crystal Report viewer的页面外,现在网站运行正常。我收到以下错误:

【问题讨论】:

  • 这个链接有帮助吗? stackoverflow.com/questions/23893444/…
  • 如果您有机会使用任何其他报告工具,我强烈建议您这样做。 asp.net 上的 CR = 极度痛苦。但该错误意味着无法创建 Crp_Cust_suratHesb 的实例。那是什么?忘记在服务器上部署 dll 了吗?

标签: asp.net vb.net iis crystal-reports iis-7.5


【解决方案1】:

我认为你可以通过不同的方式使用它。

首先创建报表文档的实例,然后尝试通过加载函数映射您的报表 根据下面给出的示例-

Imports CrystalDecisions.CrystalReports.Engine

Dim reportdocument As New ReportDocument()
reportdocument.Load(Server.MapPath("CrystalReport.rpt"))
reportdocument.SetDatabaseLogon("","","","")

【讨论】:

    【解决方案2】:

    试试:

    Imports CrystalDecisions
    Imports CrystalDecisions.CrystalReports
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    
    Dim RptDoc As New ReportDocument()
    Dim crConnectionInfo As New ConnectionInfo
    Dim CrTables As Tables
    Dim CrTable As Table
    Dim crtableLogoninfo As New TableLogOnInfo
    
    RptDoc.Load(Server.MapPath(Request.ApplicationPath + "/Reports/myReport.rpt"))
    
    With crConnectionInfo
        .ServerName = "myServer"
        .DatabaseName = "myDatabase"
        .UserID = "myUserID"
        .Password = "myPassword"
    End With
    
    CrTables = RptDoc.Database.Tables
    
    For Each CrTable In CrTables
        crtableLogoninfo = CrTable.LogOnInfo
        crtableLogoninfo.ConnectionInfo = crConnectionInfo
        CrTable.ApplyLogOnInfo(crtableLogoninfo)
    Next 
    
    RptDoc.SetDatabaseLogon(crConnectionInfo.UserID, crConnectionInfo.Password, crConnectionInfo.ServerName, crConnectionInfo.ServerName)
    
    RptDoc.SetParameterValue("@myParameter", myValue)
    
    Dim stream As New BinaryReader(RptDoc.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat))
    
    Response.ClearContent()
    Response.ClearHeaders()
    Response.ContentType = "application/pdf"
    Response.AddHeader("content-disposition", Convert.ToString("attachment; filename=") & myDownloadAsFilename)
    Response.AddHeader("content-length", stream.BaseStream.Length.ToString())
    Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)))
    Response.Flush()
    Response.Close()
    

    【讨论】:

      猜你喜欢
      • 2013-05-02
      • 2012-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-22
      • 1970-01-01
      相关资源
      最近更新 更多