0

嘿大家我正面臨着這個錯誤與水晶報告CRYSTAL REPORT FOR VISUAL STUDIO 2010 ASP.NET無效文件名錯誤

'/'應用程序中的服務器錯誤。

無效的文件名。

描述:執行當前Web請求期間發生未處理的異常。請查看堆棧跟蹤以獲取有關該錯誤的更多信息以及源代碼的位置。

異常詳細信息:System.Runtime.InteropServices.COMException:無效的文件名。

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 
[COMException (0x800001fb): Invalid file name.] 
    CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0 
    CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95 
    CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270 

[CrystalReportsException: Load report failed.] 
    CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333 
    CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +876 
    CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) +84 
    WebPathLab.AgentList.Page_Load(Object sender, EventArgs e) +524 
    System.Web.UI.Control.OnLoad(EventArgs e) +91 
    System.Web.UI.Control.LoadRecursive() +74 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207 

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.272

======================== 我使用Visual Studio 2010. Crystal報表版本爲13.0。 2000 我已經進入了下面一行在web.config中

<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"/> 

我的水晶報表工作正常,當我從Visual Studio中按F5運行2010

目錄結構

報告/數據集/ Dataset1.xsd Reports/rpt/CrystalReport1.rot 報告/ AgentList.aspx

導入的命名空間

Imports CrystalDecisions.CrystalReports.Engine 
Imports CrystalDecisions.Shared 
Imports System.Data 
Imports System.Data.SqlClient 
Imports System.Configuration 
Imports System.IO 

代碼隱藏

Dim reportpath As String = Server.MapPath("rpt/CrystalReport1.rpt") 
com.CommandText = "SELECT idAgent AS ID,AgentName,Add1 AS Address FROM PmAgentMaster" 
com.Connection = conPatho 
da.SelectCommand = com 
dt.Rows.Clear() 
If conPatho.State = ConnectionState.Closed Then conPatho.Open() 
da.Fill(dt) 
conPatho.Close() 
Dim ds As New DataSet1() 
ds.Tables(0).Merge(dt) 
ShowPopUpMsg(reportpath) 
Dim rptDoc As New ReportDocument() 
rptDoc.Load(reportpath) 
rptDoc.SetDataSource(ds) 
CrystalReportViewer1.ReportSource = rptDoc 

誰能幫我。請。

+2

誰看見我的CapsLock鍵? – Arvo 2013-05-03 13:47:48

回答

1

試試這個(注意波浪線):

Server.MapPath("~/rpt/CrystalReport1.rpt") 
+0

加載報告失敗。 錯誤出現時使用使用Server.Mappath( 「〜/ RPT/CrystalReport1.rpt」) 我的申請directroy結構是 〜/ webpathlab /表格/報告/數據集/ Dataset1.xsd 〜/ webpathlab /表格/報告/ RPT/CrystalReport1.rot 〜/ webpathlab/Forms/Reports/AgentList.aspx – 2013-05-03 14:57:09

+0

初始化後,reportpath設置爲什麼。這是對的嗎? – 2013-05-04 04:21:53

+0

D:\ WEBDATA \ pathology-software.com \ webpathlab \ Forms \ Reports \ rpt \ CrystalReport1.rpt 上述路徑由reportpath返回,它是正確的。在服務器CrystalReport1.rpt在那裏存在。 – 2013-05-04 12:01:36