Skip to Content
author's profile photo Former Member
Former Member

Random LogOnException errors with ExportToStream


We have several reports created on Crystal for Visual Studio 2008, which were migrated to VS2010. We run then on a web server (IIS7, WS2008 32 bits) on framework 4.0.

We use ExportToStream to generate PDF versions of the reports, and they run fine.

But from time to time, no clear cause (apparently not related to load, concurrent users or number of reports created), we receive errors like this:

CrystalDecisions.CrystalReports.Engine.LogOnException: Can’t connect to the database. ---> System.Runtime.InteropServices.COMException: Can’t connect to the database.

in CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

in CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

--- Inner exception ---

in CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)

in CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

en CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

en CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options)

en CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType)

after this error, no other reports can be generated. Temporary report on TEMP directory is created and everything else on our app runs fine.

Only solution is an iisreset, that gets reports running, but after some time, same happens, tried SP1, SP2 and SP3 of Crystal for VS2010

Any idea on how to deal with this?

Best regards,


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on May 01, 2012 at 03:04 PM

    Hi Luis,

    Make sure you are closing and disposing of the report objects once they are finished with. When you close the report object that should also release any database connections.

    What DB are you using and how are you connecting?

    If the DB has logging available try enabling it and watch to verify the connections your app is making are being disconnected.

    Also check your reports, if you don't need it make sure each report does NOT have any of the Verify Database Options checked on, those options should only be used when designing the report, not when using them in an application, You and your app should assume the DB has not changed at all since going to a production system.


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member


      thanks for your help and quick reply.

      Our reports had 'Verify on every print' checked, so I have changed it and deployed, no problems so far. I were already closing and disposing reports.

      We use datasets for Informix with OLEDB.

      Again, thanks for what looks like a promising solution!



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.