crystal-reportscrystal-reports-2010

Crystal Reports Exception: The maximum report processing jobs limit configured by your system administrator has been reached


I'm facing a very buggy issue, in ASP.NET application after viewing the same report many times simultaneously I got this exception:

The maximum report processing jobs limit configured by your system administrator has been reached.

I know there are tons of solutions out there but all of them are not working with me.

  1. I put ReportDocument.Close(); ReportDocument.Dispose(); in CrystalReportViewer_Unload event, and still throw the exception.
Private Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload
    reportFile.Close()
    reportFile.Dispose()
    GC.Collect()
End Sub
  1. I edit the PrintJobLimit registry in HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer and HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server to -1 even to 9999, and still throw the exception.

Here is the code snippet where I call my report:

                    Table_Infos = New TableLogOnInfos()
                    Table_Info = New TableLogOnInfo()
                    Con_Info = New ConnectionInfo()
    
                    With Con_Info
                        .ServerName = ConfigurationManager.AppSettings("server_name")
                        .DatabaseName = ConfigurationManager.AppSettings("DB")
                        .UserID = user_name
                        .Password = pass_word
                        .Type = ConnectionInfoType.SQL
                        .IntegratedSecurity = False
                    End With
    
                    Table_Info.ConnectionInfo = Con_Info
    
                    If Session("recpt_lang") = "Arabic" Then
                        reportFile.Load(Server.MapPath("/Reports/") & "collectrecpt_new_ar.rpt")
                    ElseIf Session("recpt_lang") = "English" Then
                        reportFile.Load(Server.MapPath("/Reports/") & "collectrecpt_new.rpt")
                    End If
    
                    For Each mytable In reportFile.Database.Tables
    
                        mytable.ApplyLogOnInfo(Table_Info)
    
                    Next
    
                    CrystalReportViewer1.ReportSource = reportFile
                    CrystalReportViewer1.SelectionFormula = Session("SelectionForumla")
                    CrystalReportViewer1 = Nothing

Solution

  • I would recommend moving your close/dispose/gc.collect code outside of that unload process. In other words:

    1. Load report
    2. Assign to Viewer Control
    3. Show Report in Viewer Control
    4. Close Viewer Control and Unload (completely)
    5. Then close/dispose/gc.collect outside of any viewer control code

    My guess is the viewer control is not completely closed when the report is being cleaned up.

    Crystal is a very memory intensive process and very finicky.