Problem with Crystal Reports after upgrading to .net 2.0 and CR XI R2 SP2

We recently migrated our main web app to .net 2.0, and alsy upgraded to crystal reports XI R2 SP2.  Everything appeared to be working fine, but when we went live we began experiencing periodic troubles with our reports.  We would start getting the dreaded "Load Report Failed" exception: System.Exception: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80041004):

Research seemed to indicate that this was a problem hitting the report print job limit.  My boss raised the limit in the registry to 120 while I tried to come up with a solution, however that hasn't helped a whole lot.  We get some days without trouble.  Yesterday, the server got clogged up 4 times. 

Our reporting infrastructure predates the current group and is a little messy.  We're using the CrystalReportViewer to display reports and also using the built-in tool bar for report navigation, printing, (where applicable) and exporting.  The Viewer is either bound to a ReportDocument object, or a custom object with a ReportDocument property. All report binding takes place in the Page_Load event, with a check for postback.  I'll come back to this in a moment, as it may well be the problem. 

There is no cleanup of ReportDocument objects being done and this was my first attempt to solve the problem. I tried to follow the prescribed microsoft practice in this article:

http://msdn2.microsoft.com/en-us/library/ms225490(VS.80).aspx

I called reportdocument.Close() as applicable in the page unload event.  It appeared to be working, unfortunately too well.  It was interfering with our persistence of report objects in memory.  The report would load fine but as soon as someone went to a new page/printed/exported, the report would fail to properly re-load.  Actually, the first time one of those buttons was pushed (the first postback), it worked fine.  But subsequent post backs would fail, and produce a missing parameters error iirc. 

In an act of desperation, I tried instead to just setting all objects to null when done with them.  The reports still persist fine, but we still keep getting Load Report errors. 

I don't have a code example where the CrystalReportViewer *and* it's tool bar are being used, ReportDocument objects are being persisted in session, *and* report cleanup is taking place on Page_Unload.  Is it even supposed to be possible to do all of this?  If so, how do I need to alter my approach?  I stumbled onto the article regarding binding reports in Page_Init.  I could have sworn I had tried to do that previously because that's what the Code Sample for session persistance does, but I might be mistaken.  Anything else?

0
peacemaker
8/10/2007 1:39:03 PM
📁 asp.net.crystal-reports
📃 7043 articles.
⭐ 0 followers.

💬 1 Replies
👁️‍🗨️ 957 Views

Hey there. We recently encountered the same problem on a site that was dynamically loading Crystal Reports onto the page. We have found a workaround and I've posted it here.

 I hope this helps,

 Clayton

0
claytonrumley
1/21/2008 6:52:06 PM
Reply: