CrystalReport Load report failed(CrystalReport 加载报告失败)
问题描述
我有一个使用 Crystal Report 2008 的 Windows 应用程序项目(C# 和 .NET 2.0).但在加载报告时有时会出错(似乎是意外).那个错误是:
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?
推荐答案
如果您的应用程序是独立的可执行文件,则会生成此错误,因为您在完成任何操作后都没有正确关闭报表对象.您可能会看到此错误在您的应用程序中作为 ASP.NET 应用程序运行,并且有很多用户同时访问您的站点.
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
通常默认为 75.为了调试,您可以将其设置为较小的值,使错误更快出现.
It normally is defaulted to 75. For debugging you can set it to a smaller value and cause the error to appear sooner.
使用完报表对象后,调用 .Close() 方法,该方法将清理使用的非托管资源.
When you are done using a report object, call the .Close() method which will clean up the un-managed resources used.
有些人提到将设置更改为 -1.这是一个错误,它只会导致长时间运行的应用程序出现其他问题.该过程最终将耗尽资源并开始以更难以排除故障的方式失败.
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.
这篇关于CrystalReport 加载报告失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:CrystalReport 加载报告失败
基础教程推荐
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
