2012-03-06 24 views
10

Tôi đang gặp vấn đề rất lỗi, trong ứng dụng ASP.NET sau khi xem cùng một báo cáo nhiều lần đồng thời tôi nhận ngoại lệ này:Crystal Reports Exception: Giới hạn công việc xử lý báo cáo tối đa được cấu hình bởi quản trị viên hệ thống của bạn đã đạt đến số

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

Chờ tôi biết có rất nhiều giải pháp trên mạng nhưng tất cả chúng đều không hoạt động với tôi.

  1. Tôi đặt ReportDocument.Close(); ReportDocument.Dispose(); trong sự kiện CrystalReportViewer_Unload và vẫn ném ngoại lệ.

    Private Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload reportFile.Close() reportFile.Dispose() GC.Collect() End Sub

  2. tôi chỉnh sửa registry PrintJobLimit trong HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServerHKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server đến -1 thậm chí đến 9999, và vẫn còn ném ngoại lệ.

Dưới đây là đoạn mã nơi tôi gọi là báo cáo của tôi:

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 

Trả lời

8

Tôi muốn giới thiệu di chuyển gần bạn/vứt bỏ mã/GC.Collect bên ngoài của quá trình dỡ bỏ. Nói cách khác:

  1. tải báo cáo
  2. Assign để xem kiểm soát
  3. Show Report trong Viewer kiểm soát
  4. Đóng Viewer Kiểm soát và Unload (hoàn toàn)
  5. Sau đó đóng/xử lý/GC.Collect ngoài của bất kỳ mã kiểm soát người xem nào

Đoán của tôi là kiểm soát trình xem không được đóng hoàn toàn khi báo cáo đang được dọn sạch.

Tinh thể là một quá trình chuyên sâu về bộ nhớ và rất khó tính.

+0

Tôi cũng đang cố gắng để làm như vậy bằng cách sử dụng ... nhưng cho thấy ngoại lệ kiểu đối tượng tham chiếu, vì vậy tôi phải sử dụng phương thức unload mà không nhìn tốt. –

11

Sau cùng, bạn phải Vứt bỏ trường hợp báo cáo của mình. Nếu bạn Vứt bỏ báo cáo sau khi hiển thị báo cáo, bạn sẽ không bao giờ thấy lỗi "Giới hạn công việc xử lý báo cáo tối đa được cấu hình bởi quản trị viên hệ thống của bạn đã được truy cập" một lần nữa.

Dim report1 As rptBill = clsBill.GetReport(billNumber) 

    rpt.Print() 

    'Cleanup the report after that! 
    rpt.Close() 
    rpt.Dispose() 
0

Đảm bảo bạn đang sử dụng mô hình PUSH để hiển thị báo cáo của mình. Tiếp theo, bạn cần phải thực hiện một sự thay đổi trong registry của máy chủ của bạn: Đi theo đường dẫn:

"HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer" 

và bạn sẽ thấy một mục "PrintJobLimit" và bạn sẽ thấy rằng giá trị mặc định của nó là 75. đó có nghĩa là máy chủ chỉ có thể xử lý 75 báo cáo tại một thời điểm. Đừng lo lắng về điều đó và chỉ sửa đổi giá trị thành -1

+0

Vui lòng @Mansoor kiểm tra câu hỏi của tôi Tôi đã viết rằng tôi đã làm điều đó. –

+0

Về cơ bản, bạn thực hiện công việc in không giới hạn. đây là thực hành rất rất xấu. Cũng có thể yêu cầu họ khởi động lại IIS mỗi khi nó xảy ra và bạn sẽ ổn. – oppassum

2

Chúc mừng tôi đã quá muộn để trả lời, tất cả trả lời đang hoạt động và tôi đã thấy nhưng trong trường hợp bạn vẫn gặp phải vấn đề và lỗi thì vui lòng một lần vào thư mục TEMP trong thư mục "windows" và xóa tất cả các trường hợp báo cáo tinh thể. Tôi đang nói điều này bởi vì tất cả các tùy chọn ở trên sẽ hoạt động nhưng bạn vẫn đang trong phạm vi tiếp cận tối đa nên trước hết xóa tất cả cá thể rồi áp dụng tất cả đề xuất ở trên. cảm ơn

1

Tôi đang làm việc trên máy chủ báo cáo cục bộ. Tôi đã lưu trữ ứng dụng web của tôi trong máy tính khác. Khi tôi gặp lỗi như vậy, tôi chỉ làm IISRESET và hoạt động tốt ngay bây giờ.

Hãy thử điều này, điều này có thể giúp bạn.

+0

Ai đã bỏ phiếu? Đưa ra lý do – pedram

2

Tài liệu Báo cáo tinh thể triển khai giao diện IDisposable. Vì vậy, tất cả những gì bạn phải làm là gửi kèm bản sao của báo cáo với câu lệnh using. Nó sẽ được tự động đóng lại và xử lý sau khi tuyên bố using hoàn tất. Bạn có thể viết một cái gì đó như thế:

using(var report = GetInvoiceReport()) 
{ 
    // your logic here 
} 

hoặc (phụ thuộc vào ngữ cảnh của bạn):

using(var report = new ReportDocument()) 
{ 
    // your logic here 
} 
-1

tôi đã kết thúc bằng GC.WaitForPendingFinalizers ngoài các GC.Collect, chặt chẽ và xử lý. Tôi tin rằng trang web của tôi có lẽ là dỡ và dừng xử lý chủ đề sớm trước khi rác thải được xử lý đúng

Đây là trên Server 2012, SQL 2012, CR 13.0.2000.0

Dưới đây là mã của tôi (thực sự?):

#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 

Region End

+0

nhắc nhở rằng việc chèn dữ liệu vào một crRoportDocument sẽ xuất hiện trong Page_Init và không phải Page_Load. Xem [https://scn.sap.com/thread/1070812](https://scn.sap.com/thread/1070812) – gojimmypi

1

bạn phải Dispose dụ báo cáo của bạn sau khi tất cả. Nếu bạn Dispose báo cáo sau khi hiển thị nó, bạn sẽ không bao giờ thấy lỗi:

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

Code:

Dim report1 As rptBill = clsBill.GetReport(billNumber) 

rpt.Print() 

'Cleanup the report after that! 
rpt.Close() 
rpt.Dispose() 
0

Hãy chắc chắn rằng người dùng IIS có đủ phép xóa các tập tin trình bày trong "c:/windows/tạm thời "thư mục.

tôi phải đối mặt với cùng một vấn đề khi tôi cung cấp quyền ghi vào thư mục đó sau đó nó giải quyết issue.Also tôi đảm bảo xử lý đối tượng mà sau khi tạo ra các tập tin

Các vấn đề liên quan