Crystal reports Crystal Reports异常:已达到系统管理员配置的最大报告处理作业限制

Crystal reports Crystal Reports异常:已达到系统管理员配置的最大报告处理作业限制,crystal-reports,crystal-reports-2010,Crystal Reports,Crystal Reports 2010,我面临一个非常棘手的问题,在ASP.NET应用程序中,在多次同时查看同一报告后,我遇到了以下异常: 系统配置的最大报表处理作业限制 已联系到管理员 等等,我知道有很多解决方案,但它们都不适合我 我把ReportDocument.Close()放进去;ReportDocument.Dispose();在CrystalReportViewer中卸载事件,并仍引发异常 Private Sub-CrystalReportViewer1\u Unload(ByVal sender作为对象,ByVal e作

我面临一个非常棘手的问题,在ASP.NET应用程序中,在多次同时查看同一报告后,我遇到了以下异常:

系统配置的最大报表处理作业限制 已联系到管理员

等等,我知道有很多解决方案,但它们都不适合我

  • 我把ReportDocument.Close()放进去;ReportDocument.Dispose();在CrystalReportViewer中卸载事件,并仍引发异常

    Private Sub-CrystalReportViewer1\u Unload(ByVal sender作为对象,ByVal e作为System.EventArgs)处理CrystalReportViewer1.Unload
    reportFile.Close()
    reportFile.Dispose()
    GC.Collect()
    末端接头

  • 我在
    HKEY\U LOCAL\U MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for.NET Framework 4.0\Report Application Server\InprocServer
    HKEY\U LOCAL\U MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for.NET Framework 4.0\Report Application Server\Server
    至-1甚至至9999中编辑PrintJobLimit注册表,并且仍然抛出异常

  • 以下是我调用我的报告的代码片段:

     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
    

    我建议将close/dispose/gc.collect代码移到卸载过程之外。换言之:

  • 负载报告
  • 分配给查看器控件
  • 在查看器控件中显示报表
  • 关闭查看器控件并卸载(完全卸载)
  • 然后在任何查看器控制代码之外关闭/dispose/gc.collect
  • 我猜在清理报表时,查看器控件没有完全关闭


    晶体是一个非常内存密集的过程,非常挑剔

    毕竟,您必须处理报表实例。 如果在显示报告后对其进行处理,您将永远不会再次看到错误“已达到系统管理员配置的最大报告处理作业限制”


    确保您正在使用推送模型来显示报告。接下来,您必须在服务器的注册表中进行一项更改:按照以下路径操作:

    "HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer" 
    
    您将看到一个项目“PrintJobLimit”,您将看到它的默认值是75。这意味着服务器一次只能处理75个报告。
    别担心,把值改成-1就行了。我来不及得到答案了, 所有回复都正常工作,我已经看到了,但如果您仍然面临相同的问题和错误,请立即进入“windows”目录下的临时文件夹并删除crystal report的所有实例。 我这么说是因为上面的所有选项都会起作用,但您仍然处于最大范围内,所以首先删除所有实例,然后应用上面的所有建议。
    谢谢

    我在本地报表服务器上工作。我已经在其他pc上托管了我的web应用程序。当我遇到这样的错误时,我只是做了IISRESET,现在工作正常


    试试这个,这可能会对您有所帮助。

    Crystal Report文档实现了
    IDisposable
    接口。因此,您所要做的就是使用语句将报表实例括起来。一旦
    using
    语句完成,它将自动关闭并释放。你可以这样写:

    using(var report = GetInvoiceReport())
    {
         // your logic here
    }
    
    或者(取决于您的上下文):


    除了GC.Collect、close和dispose之外,我还使用了GC.WaitForPendingFinalizers。我相信我的网页可能在垃圾被正确处理之前卸载并过早停止线程处理(真的吗?)

    这在Server 2012、SQL 2012、CR 13.0.2000.0上

    这是我的密码:

    #Region "Cleanup"
    
    Private Sub crCleanup(Optional blnForce As Boolean = False)
        Try
            ' Crystal(code Is Not managed, i.e.it) 's COM interop => you have to manually
            ' release any objects instantiated. Make sure you set the ref to nothing and
            ' also call the dispose method if it has one.
    
            ' under some conditions, we don't want to destroy the ReportDocument (e.g. report page-to-page navigation)
            If blnForce OrElse Me.blnPageHasFatalError OrElse (Not Me.CrystalUseCache) Then ' do not release when using cache! (unless forced)
                If Not crReportDocument Is Nothing Then Me.crReportDocument.Close()
                If Not crReportDocument Is Nothing Then Me.crReportDocument.Dispose()
                If Not thisWebAppUser Is Nothing Then Me.thisWebAppUser.Dispose()
                Me.thisWebAppUser.ClearReportCache() ' we are using HttpContext.Current.Cache.Item instead of sessions to save CR document
            End If
    
            ' the rest of the items, we'll always want to clean up
            If Not crParameterFieldDefinitions Is Nothing Then crParameterFieldDefinitions.Dispose()
            If Not crParameterFieldDefinition Is Nothing Then crParameterFieldDefinition.Dispose()
    
            crParameterFields = Nothing
            crParameterField = Nothing
            crParameterFieldName = Nothing
            crParameterValues = Nothing
            crParameterDiscreteValue = Nothing
            crParameterDefaultValue = Nothing
            crParameterRangeValue = Nothing
    
            '
            If Not crSections Is Nothing Then crSections.Dispose()
            If Not crSection Is Nothing Then crSection.Dispose()
            If Not crReportObjects Is Nothing Then crReportObjects.Dispose()
            If Not crReportObject Is Nothing Then crReportObject.Dispose()
            If Not crSubreportObject Is Nothing Then crSubreportObject.Dispose()
            If Not crDatabase Is Nothing Then crDatabase.Dispose()
            If Not crTables Is Nothing Then crTables.Dispose()
            If Not crTable Is Nothing Then crTable.Dispose()
            crLogOnInfo = Nothing
            crConnInfo = Nothing
    
            crDiskFileDestinationOptions = Nothing
            ConnParam = Nothing
    
            If Not subRepDoc Is Nothing Then subRepDoc.Dispose()
        Catch ex As Exception
            Me.thisWebAppUser.SendSysAdminMessage("Failed CR cleanup", ex.ToString)
        End Try
    
    
        ' yes, use of the GC.Collect (and even more the GC.WaitForPendingFinalizers) is highly controversial
        ' 
        ' the reality is that rendering crystal reports is rather slow compared to most web operations
        ' so it is expected that waiting for GC will have relatively little performance impact
        ' and will in fact, help tremendously with memory management.
        '
        ' try setting these values to 1 and confirm for yourself by instantiating multiple crDocuments in different browsers if you don't believe it:
        '
        '   HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer 
        '   HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server 
        '
        ' or google this error: The maximum report processing jobs limit configured by your system administrator has been reached
        ' 
        ' I believe the problem is that on very fast servers, the page unloads and stops processing code to properly cleanup the Crystal Report objects
        ' 
        ' This is done in 3 places: 
        '   Report Viewer (Page_Unload and CrystalReportViewer1_Unload) rendering a report will of course always using a processing job
        '   Report Parameter Selector (Page_Unload) loading a crDocument without rendering a report still counts towards CR processing job limit.
        '   Custom Control crReportParameterSelectionTable (Public Overrides Sub dispose())
    
        GC.Collect()
        GC.WaitForPendingFinalizers()
    
    End Sub
    '***********************************************************************************************************************************
    ' 
    '***********************************************************************************************************************************
    Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload
        'If Me.IsCallback Then Exit Sub ' the menutree causes callbacks, but we are not interested
    
        crCleanup()
        ' response object not available here, so cannot redirect (such as in the case of XLS opeing in a separate window)
    
        ' if for some crazy reason there is STILL a crReportDocument, set it to nothing
        '        If Not crReportDocument Is Nothing Then Me.crReportDocument = Nothing
        '        Me.CrystalReportViewer1 = Nothing
    End Sub
    
    Private Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload
        'If Me.IsCallback Then Exit Sub ' the menutree causes callbacks, but we are not interested
    
        crCleanup()
    End Sub
    

    结束区域您毕竟必须
    处理您的报表实例。如果在显示报告后
    Dispose
    ,您将永远不会看到错误:

    已达到系统管理员配置的最大报表处理作业限制

    代码:


    确保IIS用户有足够的权限删除“c:/windows/temp”文件夹中的文件


    一旦我提供了对该文件夹的写入权限,它就解决了我的问题。另外,请确保在生成文件后处理该对象。在我的情况下,该报表有4个子报表

    我解决的问题是在以下Regedit路径中将“PrintJobLimit”的值从75更改为500:

    • \HKEY\U LOCAL\U MACHINE\SOFTWARE\WOW6432Node\SAP BusinessObjects\Crystal Reports for.NET Framework 4.0\Report Application Server\InprocServer

    • \HKEY\U LOCAL\U MACHINE\SOFTWARE\WOW6432Node\SAP BusinessObjects\Crystal Reports for.NET Framework 4.0\Report Application Server\Server


    我知道此线程较旧,但如果您将应用程序池设置“Recycling…”配置为在180分钟而不是1740分钟(默认值)进行回收,这可能会释放所需的资源。

    我也尝试使用…进行同样的操作,但这显示了对象引用类型异常,所以我不得不使用卸载方法,这看起来不太好。你能在这里发布所有这5点的完整代码吗。请@Mansoor检查我写的问题,我已经这样做了。你基本上是使打印作业不受限制。这是非常非常糟糕的做法。还不如告诉他们每次重新启动IIS,这样您就没事了。提醒您,将数据填充到crRoportDocument中应该发生在Page_Init中,而不是Page_Load中。查看此解决方案是否适用于我的仅客户端Crystal Report viewer WinForm应用程序。我只需要更改“服务器”版本。我刚把它改成500,瞧。我的应用程序不会泄漏内存或随着时间的推移而变慢。查看器控件具有这种愚蠢的限制。如果IIS用户有权在temp中创建文件,为什么它没有权限在以后删除它们?
    using(var report = new ReportDocument())
    {
         // your logic here
    }
    
    #Region "Cleanup"
    
    Private Sub crCleanup(Optional blnForce As Boolean = False)
        Try
            ' Crystal(code Is Not managed, i.e.it) 's COM interop => you have to manually
            ' release any objects instantiated. Make sure you set the ref to nothing and
            ' also call the dispose method if it has one.
    
            ' under some conditions, we don't want to destroy the ReportDocument (e.g. report page-to-page navigation)
            If blnForce OrElse Me.blnPageHasFatalError OrElse (Not Me.CrystalUseCache) Then ' do not release when using cache! (unless forced)
                If Not crReportDocument Is Nothing Then Me.crReportDocument.Close()
                If Not crReportDocument Is Nothing Then Me.crReportDocument.Dispose()
                If Not thisWebAppUser Is Nothing Then Me.thisWebAppUser.Dispose()
                Me.thisWebAppUser.ClearReportCache() ' we are using HttpContext.Current.Cache.Item instead of sessions to save CR document
            End If
    
            ' the rest of the items, we'll always want to clean up
            If Not crParameterFieldDefinitions Is Nothing Then crParameterFieldDefinitions.Dispose()
            If Not crParameterFieldDefinition Is Nothing Then crParameterFieldDefinition.Dispose()
    
            crParameterFields = Nothing
            crParameterField = Nothing
            crParameterFieldName = Nothing
            crParameterValues = Nothing
            crParameterDiscreteValue = Nothing
            crParameterDefaultValue = Nothing
            crParameterRangeValue = Nothing
    
            '
            If Not crSections Is Nothing Then crSections.Dispose()
            If Not crSection Is Nothing Then crSection.Dispose()
            If Not crReportObjects Is Nothing Then crReportObjects.Dispose()
            If Not crReportObject Is Nothing Then crReportObject.Dispose()
            If Not crSubreportObject Is Nothing Then crSubreportObject.Dispose()
            If Not crDatabase Is Nothing Then crDatabase.Dispose()
            If Not crTables Is Nothing Then crTables.Dispose()
            If Not crTable Is Nothing Then crTable.Dispose()
            crLogOnInfo = Nothing
            crConnInfo = Nothing
    
            crDiskFileDestinationOptions = Nothing
            ConnParam = Nothing
    
            If Not subRepDoc Is Nothing Then subRepDoc.Dispose()
        Catch ex As Exception
            Me.thisWebAppUser.SendSysAdminMessage("Failed CR cleanup", ex.ToString)
        End Try
    
    
        ' yes, use of the GC.Collect (and even more the GC.WaitForPendingFinalizers) is highly controversial
        ' 
        ' the reality is that rendering crystal reports is rather slow compared to most web operations
        ' so it is expected that waiting for GC will have relatively little performance impact
        ' and will in fact, help tremendously with memory management.
        '
        ' try setting these values to 1 and confirm for yourself by instantiating multiple crDocuments in different browsers if you don't believe it:
        '
        '   HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer 
        '   HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server 
        '
        ' or google this error: The maximum report processing jobs limit configured by your system administrator has been reached
        ' 
        ' I believe the problem is that on very fast servers, the page unloads and stops processing code to properly cleanup the Crystal Report objects
        ' 
        ' This is done in 3 places: 
        '   Report Viewer (Page_Unload and CrystalReportViewer1_Unload) rendering a report will of course always using a processing job
        '   Report Parameter Selector (Page_Unload) loading a crDocument without rendering a report still counts towards CR processing job limit.
        '   Custom Control crReportParameterSelectionTable (Public Overrides Sub dispose())
    
        GC.Collect()
        GC.WaitForPendingFinalizers()
    
    End Sub
    '***********************************************************************************************************************************
    ' 
    '***********************************************************************************************************************************
    Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload
        'If Me.IsCallback Then Exit Sub ' the menutree causes callbacks, but we are not interested
    
        crCleanup()
        ' response object not available here, so cannot redirect (such as in the case of XLS opeing in a separate window)
    
        ' if for some crazy reason there is STILL a crReportDocument, set it to nothing
        '        If Not crReportDocument Is Nothing Then Me.crReportDocument = Nothing
        '        Me.CrystalReportViewer1 = Nothing
    End Sub
    
    Private Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload
        'If Me.IsCallback Then Exit Sub ' the menutree causes callbacks, but we are not interested
    
        crCleanup()
    End Sub
    
    Dim report1 As rptBill = clsBill.GetReport(billNumber)
    
    rpt.Print()
    
    'Cleanup the report after that!
    rpt.Close()
    rpt.Dispose()