.Net Crystal Report printing application running on termianal service connection errors when session
- by MrEdmundo
I have created a .Net application to run on an App Server that gets requests for a report and prints out the requested report.
The C# application uses Crystal Reports to load the report and subsequently print it out.
The application is run on Server which is connected to via a Remote Desktop connection under a particular user account (required for old apps). When I disconnect from the Remote Session the application starts raising exceptions such as:
Message: CrystalDecisions.Shared.CrystalReportsException: Load report failed
This type of error is never raised when the Remote Session is active. The server running the app is running Windows Server 2003, my box which creates the connection is Windows XP.
I appreciate this is fairly weird, however I cannot see any problem with the application deployment I have created.
Does anyone know what could be cause this issue?
EDIT: I bit the bullet and created the application as a windows service, obviously this doesn't take long I just wasn't convinced it would solve the problem. Anyway it doesn't!!!
I have also tried removing the multi-thread code that was calling the print function asynchronously. I did this in order to simply the app and narrow down the reason it could fail. Anyway, this didn't improve the situation either!
EDIT: The two errors I get are:
System.Runtime.InteropServices.COMException
(0x80000201): Invalid printer
specified. at
CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.ModifyPrinterName(String
newVal) at
CrystalDecisions.CrystalReports.Engine.PrintOptions.set_PrinterName(String
value) at
Dsa.PrintServer.Service.Service.PrintCrystalReport(Report
report)
The printer isn't invalid, this is confirmed when 60 seconds later the time ticks and the report is printed successfully.
And
The request could not be submitted for
background processing. at
CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.GetLastPageNumber(RequestContext
pRequestContext) at
CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(ReportPageRequestContext
reqContext) --- End of inner
exception stack trace --- at
CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception
e) at
CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(ReportPageRequestContext
reqContext) at
CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32
nCopies, Boolean collated, Int32
startPageN, Int32 endPageN) at
CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32
nCopies, Boolean collated, Int32
startPageN, Int32 endPageN) at
Dsa.PrintServer.Service.Service.PrintCrystalReport(Report
report)
EDIT:
I ran filemon to check if there were any access issue. At the point when the error occurs file mon reports
Request: OPEN | Path: C:\windows\assembly\gac_msil\system\2.0.0.0__b77a5c561934e089\ws2_32.dll | Result: NOT FOUND | Other: Attributes Error