What is a large report ? In this case, I define a large report as a report file (.rpt) larger than 50MB. These reports contain 25+ subreports and some subreports have raster images inserted into them.
I created a WCF service that, when passed a report ID and report parameters, generates a report in PDF format. The report is streamed to the client from the service. The service uses the document.ExportToStream() method.
The service works very well, most of the time. We have over 75 reports that run without a problem. Only reports generated from a large rpt cause a problem. We only have a few (< 5) reports like this but they are life-critical. This project will not be released to production until this issue is resolved.
When a large report is run, it always blows up and the following exception is thrown:
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
Details: [Database Vendor Code: 18456 ] Failed to export the report.
Error in File ABCDEFGHIJKLMNOQRSTU {AE6C562B-B241-4412-BBD4-7C1A1DC438C1}.rpt:
Unable to connect: incorrect log on parameters.
Details: [Database Vendor Code: 18456 ] ---> System.Runtime.InteropServices.COMException: Logon failed.
Details: [Database Vendor Code: 18456 ] Failed to export the report.
Error in File ABCDEFGHIJKLMNOQRSTU {AE6C562B-B241-4412-BBD4-7C1A1DC438C1}.rpt:
Unable to connect: incorrect log on parameters.
Details: [Database Vendor Code: 18456 ]
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
--- End of inner exception stack trace ---
at CRHelperLib.CrystalReportHelper.ExportToStream(ExportFormatType fileType) in C:\Svc\CRHelperLib\CrystalReportHelper.cs:line 180
at ReportingSvc.ReportGenerator.BuildReport(CrObject cro, ExportFormatType outputFormat) in C:\Svc\ReportGenerator.cs:line 574
I need to point out this report runs fine in the current production system. There are no logon errors and NONE of the smaller reports have any problems. It's also important to note that the service was a complete rewrite of what's in production. The code shares little, if any, similarities.
The current production system uses ExportToHttpResponse() in the code-behind of a single reporting web page to return the report. A service was created to abstract the reporting feature from the web application and allow reports to be run from multiple locations within the application (not just a single page) and, in the future, from multiple applications.
My question really comes down to the following:
1) Can I reasonably expect my service to process a 50+MB rpt file and return the results without this exception? Is this realistic or should we talk to the report designer and make changes in the report design?
2) Instead of using ExportToHttpResponse() or ExportToStream(), how do I export the report to a byte array (byte []) and return that instead of a stream? Although ExportToHttpResponse() works in the current system, we can't use it since we don't have a response outside of the web page, in the context of a WCF service.
Edited by: scottw on Dec 12, 2011 9:23 PM