cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

Hi Lawrence

Please ensure that you are using sticky sessions. See KBA 1496619 - Event Viewer warning; A Crystal Reports job was delayed x seconds waiting for a free licen...

Also, consider updating to SP 14:

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Former Member
0 Kudos

Thank you for responding Ludek.

At this juncture I am not dealing with a load balancer (I am using my development machine and storing the session state on a server within my domain for testing).  So the use of "Sticky Sessions" does not really apply to my dev machine (I don't think).

Can you advise if I am wrong about that please?

I have upgraded to 14 and the problem is the same.

Is there anything else I might be missing?

As always, I appreciate the help!