• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 719
  • Last Modified:

VS 2008 Adobe error

I have implemented about 200 VS 2008 web pages with nearly 50 of them that will crate an automatic display of an Adobe PDF from a Crystal Report.  

Yesterday I got an error message "the maximum number of pdf documents that can be simultaneous opened in the browser has been exceeded".  

Does anybody have a fix for this?  Maybe a IIS / Registery / Business objects setting?
0
AmerenCallaway
Asked:
AmerenCallaway
  • 9
  • 8
1 Solution
 
mlmccCommented:
You can open 1000 documents.  It is hardcoded in the reader so you can't overcome it.

See this link from the Adobe knowledgebase
http://support.adobe.com/devsup/devsup.nsf/docs/51744.htm

mlmcc
0
 
CodeCruiserCommented:
Do you open the documents within the browser or separately in the adobe reader?
0
 
AmerenCallawayAuthor Commented:
Well the long story is that when I got the error I was running a test on my machine and had never seen the error before.  In a few minutes the server actually crashed so my idea was that maybe I had made the server upset with so many documents being opened.  

CodeCruiser the answer to your question is that I am opening them within a browser, but .... they really turn out to be seperate adobe files.  So if I have 100 users running the app, then 100 adobe files would be opened.  The situation is really unavoidable do to the customer population I have to suppor.

What I did try yesterday is to move my report close and dispose methods right after the render.  So once the server renders the report to the web page I automaticaly close & dispose.  

I did not add a garbage collector to that process.... Guess that might be my next step.
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
AmerenCallawayAuthor Commented:
mlmcc.  
   What is the typical work around?  It is simple as a reboot?

0
 
CodeCruiserCommented:
So when you test the app, you have pdf files on the server which are being opended by the users right? Were the server and client on same machine when you tested? Is it 1 file per user for 100 users or 100 files per 1 user? Adobe Reader is a very heavy software and when you open a pdf file within browser, the browser has to host the Adobe Reader within itself. Have 100 readers loaded inside browser would be problematic due to reasons such as lack of address space etc.
0
 
AmerenCallawayAuthor Commented:
To answer the question about the PDF's.  These files do not exist on the server per say.  What happens with this integration is that when 2008 renders the Crystal --> Adobe you have an abobe file that gets created on the client machine.  When I was doing testing on my local machine I did not attempt to open this many documents.  The amount of files are 1--> Many.  So I can have one web site or one web page for that matter that could render the same document 100+ times.  But not to the same client pc.

You are correct with what you said about memory leaks.  This was another interesting thing I noticed on the Adobe --> IE integration.  Depending on file size I could to mulitple small documents in IE without a problem, but if I got larger files I have a leak.  This is statement in itself is enough to make me want to add the garbage collector.

See attached code.  As a add on this is a ADO / SQL server integration.


    Private Sub ConfigureCrystalReports(ByVal params As ParameterFields)
        myReport = New ReportDocument
        Dim reportPath As String = Server.MapPath("ReportName")
        myReport.Load(reportPath)
        Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo
        myConnectionInfo.ServerName = Application("sqlServ")
        myConnectionInfo.DatabaseName = Application("dbName")
        myConnectionInfo.UserID = Application("uID")
        myConnectionInfo.Password = Application("pwd")
        SetDBLogonForReport(myConnectionInfo, myReport)
        CrystalReportViewer1.ParameterFieldInfo = params
 
        myReport.SetParameterValue("Parm1", sValue)
        myReport.SetParameterValue("Parm2", sValue2)
        myReport.SetParameterValue("Parm3", sValue3)
        myReport.SetParameterValue("Parm4", sValue4)
        myReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, "ReportName")
        Session("ReportName") = myReport
        myReport.Close()
        myReport.Dispose()
    End Sub

Open in new window

0
 
CodeCruiserCommented:
>Session("ReportName") = myReport
This line seems to be alarming to me. You are storing a full crystal report(which takes a lot of memory) in the session. Try by commenting this line out.
0
 
AmerenCallawayAuthor Commented:
CodeCruiser.
    Thanks for the suggestion.  I have tried on 2 pages so far an it works.  But this is only valid for the Crystal --> Adobe integration.  If you try the same thing in a 2008 --> Crystal --> Web page that displays BO report it doesn't.  So the one line difference is where you render to Crystal.

        CrystalReportViewer1.ReportSource = myReport

From what I am seeing you still need the Session("ReportName") = myReport.  And from initial testing the close & dispose will need moved.

I will be doing more testing next week to see if this will work for all the Adobe integration.
0
 
CodeCruiserCommented:
Ok lets start again. You have a web page with multiple users. You export a crystal report to pdf for each of these users. Do you use the same report again and again to export to pdf? Why do you need to save it to session?
0
 
AmerenCallawayAuthor Commented:
Actually I have 2 integrations.

1)  Crystal to Adobe.  This does not appear to need a session being opened.  But this integration is not so much an export (since report will only exist on the client machine). If I use the term render I think that is more appropriate.  The applications that call my web pages will get the automatice PDF rendered into a IE session.  This would not nessicarily have to be an adobe dependent render.  It could be any PDF render tool that will integrate with IE.  

2)  Crystal Report to Web Page.  So in this case you will see the same report only with a BO title bar.  But as a part of the BO integration this report can be printed (usually to Adobe).  But it also can be exported to xls, doc, rpt, pdf.   Maybe I don't neeed to save it to a session.  But this is the examples I have seen many other places.  I basically need the report to show in my customer IE.  Maybe a session is not the best way, but I have not seen another example.  But I am open to suggestions.
    Private Sub ConfigureCrystalReports(ByVal params As String)
 
        myReport = New ReportDocument
         Dim reportPath As String = Server.MapPath("ReportName")
        myReport.Load(reportPath)
        Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo
        myConnectionInfo.ServerName = Application("sqlServ")
        myConnectionInfo.DatabaseName = Application("dbName")
        myConnectionInfo.UserID = Application("uID")
        myConnectionInfo.Password = Application("pwd")
        SetDBLogonForReport(myConnectionInfo, myReport)
        If params <> Nothing Then
            CrystalReportViewer1.SelectionFormula = params
        Else
            CrystalReportViewer1.SelectionFormula = Nothing
        End If
        CrystalReportViewer1.ReportSource = myReport
        Session("ReportName") = myReport
    End Sub

Open in new window

TitleBar.bmp
0
 
CodeCruiserCommented:
This code is within a sub. If you do not have another sub and you call this sub whenever you need to generate the report then you do not need to save it to session as the sub recreates the report anyway. If you have another sub which checks the session first and if the report already exists then utilizes it, then it makes sense to store the report to the session. Does the user print or open the report multiple times during the visit on the web?
0
 
AmerenCallawayAuthor Commented:
Not sure.  Some users will just look at the report once.  Maybe print / export and close IE.  Others will open one / multiple reports from the same IE.   So maybe I can not have a good answer.  But as far as sub question yes I am doing this from another sub.

See attached sample.  This one has the garbage collector, but it may not be in the right spot.
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource
 
Partial Class _ReportName
    Inherits System.Web.UI.Page
    Private myReport As ReportDocument
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack Then
            If Not Session("ReportName") Is Nothing Then
                CrystalReportViewer1.ReportSource = CType(Session("ReportName"), CrystalDecisions.CrystalReports.Engine.ReportDocument)
            End If
        Else
            configureParameters()
        End If
    End Sub
 
 
    Private Sub configureParameters()
        Dim sPass As String
        Try
            sPass = Request.QueryString("sParam").ToString
        Catch ex As Exception
            sPass = Nothing
        End Try
        ConfigureCrystalReports(sPass)
    End Sub
 
    Private Sub ConfigureCrystalReports(ByVal params As String)
 
        myReport = New ReportDocument
        Dim reportPath As String = Server.MapPath("ReportName.rpt")
        myReport.Load(reportPath)
        Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo
        myConnectionInfo.ServerName = Application("sqlServ")
        myConnectionInfo.DatabaseName = Application("dbName")
        myConnectionInfo.UserID = Application("uID")
        myConnectionInfo.Password = Application("pwd")
        SetDBLogonForReport(myConnectionInfo, myReport)
        If params <> Nothing Then
            CrystalReportViewer1.SelectionFormula = params
        Else
            CrystalReportViewer1.SelectionFormula = Nothing
        End If
        CrystalReportViewer1.ReportSource = myReport
        Session("ReportName") = myReport
    End Sub
 
    Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
        Dim myTables As Tables = myReportDocument.Database.Tables
        For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
            Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
            myTableLogonInfo.ConnectionInfo = myConnectionInfo
            myTable.ApplyLogOnInfo(myTableLogonInfo)
        Next
    End Sub
    Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
        Try
 
            If Page.IsPostBack Then
 
                If myReport IsNot Nothing Then
                    If myReport.IsLoaded Then
                        myReport.Close()
                    End If
                    myReport.Dispose()
                End If
 
            End If
 
        Catch ex As Exception
            Throw New Exception(ex.ToString)
        Finally
            GC.Collect()
        End Try
 
    End Sub
End Class

Open in new window

0
 
CodeCruiserCommented:
It looks fine. Now an odd question. Does the webserver crash or the user IE?
0
 
AmerenCallawayAuthor Commented:
Well depending on what you are doing BOTH.

If you have to many IE tabe with Adobe you have a IE crash.  I have not seen a IE crash yet with the Crystal Report to web page render YET.  I hate to say yet, but that is a scenario I have yet to test or consider, since an atypical user might run multiple reports during the day, but I have yet to have one run 100's on one pc.  This does not mean it won't happen.

My real worry lies with the web server.  I have seen this server crash a couple times since I did a production release and had many fires to put out.  Most of the time an IIS reset will fix my issue, so I have been very lucky to not have to do a reboot or even worse a shutdown.  
0
 
CodeCruiserCommented:
The problem on the IE side is as i  said before that Adobe takes a lot of resources and when you open 100s of these resource hungary addins inside a host process(IE), it takes it down. You would not have this problem when export crystal report to webpage as it is simple HTML so IE would not have a problem with it.

The problem with the webserver seems to be memory problem as well. Try creating many sessions on the server and then check the memory and processor usage of the asp.net worker processes(w3wp.exe i think).
0
 
AmerenCallawayAuthor Commented:
I will see if I can get large group of customers to open mulitple reports at the same time.  But with that being said I have 4GB of Ram and from what i just found out from my server group I so far have not used more than 20% of the memory,  From what I have seen so far on the CPU / Memory side is that I am not so much using memory as I am spiking / maxing out the CPU.  And given the nature of Crystal (CPU hog) I am not sure how much more I would need for a "once in a while" problem.  So if I were able to max out the CPU for minutes at a time I will eventually have a webserver crash from that.  

As a side note one of the issues I was having related to permissions on the temp directory.  So my generic local internet accounts did not have modify access.  You can only imagine how much fun that was to diagnose & fix.
0
 
CodeCruiserCommented:
Crystal Reports is a very resource hungary and Slow software in my experience.
0
 
AmerenCallawayAuthor Commented:
Thanks for the help.  Still having a server crash, but exploring the sessions question we discussed before.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now