Hello,
We have been using Crystal Reports Version 13.0.9 for Visual Studio 2010 and implementing the report using a crystal object viewer control in an ASP.NET page.
We have been using "In-Process" for our session state in our web servers (using IIS 7.5). We are ready to go to a Web Farm using State Server for our Sessions.
Our hang up is with our crystal application. The report will RUN the first time it opens. If we attempt to interact with the report in any way (select the next page, select the next record, print etc...) it hangs up and we eventually (it takes some time...like a few minutes) get the dreaded "Database Vendor Code 17, failure to connect" Error.
We have basically debugged to the following line of code where it attempts to set the ReportSource to the already existing ReportDocument object which we place in a Session object:
if (IsPostBack)
{
//where reportViewer is the crystalreportviewer control
reportViewer.ReportSource = (ReportDocument)Session["Report"];
}
There is no doubt in my mind that changing our method of saving the Session State is affecting this line in "some" way. I know that all classes need to to be Serializable, but previous searches indicate that ReportDocument is in fact Serializable. So I don't know what else we are missing.
Here is some technical stuff that may be helpful in solving this:
1.) We are using the "Push Method" for setting DataSources
2.) We use SQL Server 2012 on a remote server within our Domain of the Web Server
3.) We are using Crystal Reports Version 13.0.9, but I upgraded to 13.0.13 to see if that solved the problem...it did not (same issue)
4.) When creating the report object, we do use a ReportFactory class to assist with load control. See below for a snippet of this:
objReport = ReportFactory.GetReport(objReport.GetType());
objReport.Load(crystalPath + rptName);
public class ReportFactory {
protected static Queue reportQueue = new Queue();
protected static ReportDocument CreateReport(Type reportClass) {
object report = Activator.CreateInstance(reportClass);
reportQueue.Enqueue(report);
return (ReportDocument)report;
}
public static ReportDocument GetReport(Type reportClass) {
//75 is my print job limit.
if (reportQueue.Count > 70) {
((ReportDocument)reportQueue.Dequeue()).Dispose();
GC.WaitForPendingFinalizers();
GC.Collect();
}
return CreateReport(reportClass);
}
public static int getLength() {
return reportQueue.Count;
}
}
Any suggestions?
Thanks!
Lawrence Giles