Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ReportDocument Session not working after setting session state to "StateServer"

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

Tags:
Former Member
Former Member replied

After a few more attempts at figuring out the answer I have implemented a "work around."

Instead of storing the report object into a session I am storing a List of DataSources into a session and then re-rendering the report object based on those sessions.

This appears to satisfy the requirement of getting Session State using StateServer instead of In-Proc to work for my site.

I still have not received any good reason why the ReportDocument object is incapable of being re-used when using StateServer in this manner, but since I did not design that object I can't ever know.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question