Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

c# - CrystalReport Load report failed

I have a windows application project (C# and .NET 2.0) that used Crystal Report 2008. But I get error sometimes (it seems accidentally) in loading report. That error is:

CrystalDecisions.Shared.CrystalReportsException: Load report failed.
System.Runtime.InteropServices.COMException (0x8000020D): Unable to load report.
   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   --- End of inner exception stack trace ---
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at SIA.DataTransfer.Forms.frmReport.GetStateReport(Int32 transferType)

please guide me. How can I solve this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If your application is a standalone executable then this error is generated because you are not closing your report object properly when you are done with whatever you do. You might see this error running in your application as an ASP.NET app with a lot of users accessing your site simultaneously.

You can cause the error to appear sooner by tweaking this registry key:

HKEY_LOCAL_MACHINESOFTWARECRYSTAL DECISIONS10.0REPORT APPLICATION SERVERSERVERPrintJobLimit

It normally is defaulted to 75. For debugging you can set it to a smaller value and cause the error to appear sooner.

When you are done using a report object, call the .Close() method which will clean up the un-managed resources used.

There are those that mention to change the setting to -1. This is a mistake, it will only cause other problems for an application that is long running. The process will eventually run out of resources and start to fail in ways that will be even more difficult to troubleshoot.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...