我已经完成了以下问题。请不要将我的问题标记为重复。 https://stackoverflow.com/questions/24432683/crystal-report-is-not-showing-data-after-some-time-in-cr-version-13-0-2000-0 我从上个月开始面对这个问题。我的水晶报告工作正常(windows-7 32bit,VS2010,Crystal报告V.13)。我部署在服务器上(Windows server-2012 64bit,核心i5)。问题是在一段时间后报告变空。我搜索了很多关于它并使用Dispose(),Close()方法,现在我使用以下代码。
public static void OpenPdfInBrowser(ReportClass RptReport)
{
string strFilename;
string strFolderName;
string strFile = String.Empty;
string strReportOutputName = String.Empty;
HttpResponse objResponse = HttpContext.Current.Response;
HttpSessionState objSession = HttpContext.Current.Session;
HttpServerUtility objServer = HttpContext.Current.Server;
strFolderName = objServer.MapPath("../ReportOutput");
if (Directory.Exists(strFolderName) == false)
{
Directory.CreateDirectory(strFolderName);
}
//Generate the File Name
strFilename = "";
strFile = objSession.SessionID.ToString() + "_" + DateTime.Now.Ticks.ToString() + ".pdf";
strFilename = strFolderName + "\\" + strFile;
//Set the File Name
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
diskOpts.DiskFileName = strFilename;
//Set the Various Options
ExportOptions exportOpts = new ExportOptions();
exportOpts = RptReport.ExportOptions;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
exportOpts.DestinationOptions = diskOpts;
//Export the Report
RptReport.Export();
//Stream it to the Client
objResponse.ClearContent();
objResponse.ClearHeaders();
strReportOutputName = "Report";
objResponse.ContentType = "application/pdf";
objResponse.AddHeader("Content-Disposition", "inline;filename=Report.pdf");
objResponse.WriteFile(strFilename);
objResponse.Flush();
objResponse.Close();
//Delete the File
System.IO.File.Delete(strFilename);
//Close the Report Object
RptReport.Close();
RptReport.Dispose();
GC.Collect();
}
I am getting the following error in event viewer on deployment server.
The description for Event ID 4353 from source Crystal Reports cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
无法加载键代码程序集BusinessObjects.Licensing.KeycodeDecoder.dll。 任何帮助将不胜感激。感谢adnvace。
答案 0 :(得分:1)
将您的asp.net文件夹复制到服务器虚拟目录...
不确定,但希望你的问题能解决。祝你好运。
答案 1 :(得分:1)
问题看起来与服务器上的Crystal报表安装有关...如果它在开发机器上工作正常,并且如果在部署服务器上安装了运行Crystal报表所需的所有应用程序,那么请,检查.. IIS中的应用程序池 - >选择用于Web应用程序的应用程序池 - >高级设置 - >启用32应用程序 - >将此设置为“True”..
请尝试检查......
答案 2 :(得分:1)
经过长时间的研究,我的问题已通过在注册表中进行以下更改得到解决。实际上,此问题与打印作业限制有关,默认情况下,我只是根据我的要求扩展其数据大小,它对我有用。
转到 - > RUN -----> Regedit 1-HKEY_LOCAL_MACHINE 2-SOFTWARE 3-SAP业务对象 .NET FRAMEWORK的4-CRYSTAL报告(您的版本号) 5-REPORT应用服务器 6-SERVER
然后得到“PrintJobLimit”PROPERTY并将其数据大小更改为您想要的任何内容。 感谢每一个帮助我的人
答案 3 :(得分:0)
你的方法是正确的.close和。处置,但使用它的最佳方式是:
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
cryRpt.Close()
cryRpt.Dispose()
End Sub
以PDF格式打开水晶报告,您可以使用http响应,它的性能会更好:
cryRpt = New ReportDocument
cryRpt.Load(Server.MapPath("Your report path"))
cryRpt.SetDataSource(Your data source)
cryRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "ExportedReport")