views:

3530

answers:

9

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

A: 

If you create a window service wrapper for your application, it means that it will continue to run regardless of users logged in. It can also be set to start up automatically. I think that because you are using an actual application, and not a windows service it is not actually running once you logout of a session on the server.

Here is an example on Code Project:

http://www.codeproject.com/KB/system/WindowsService.aspx

REA_ANDREW
I have created a number of windows services in the past, but thanks for the link. The application is definitely running, as not every request fails. We also have other apps running on there without a problem. This seems to be Crystal Reports specific.
MrEdmundo
A: 

Are you sure you are "disconnecting' you remote session as opposed to "logging off". I disconnect my sessions to a nt server 2003 all the time and everything to continues to run just fine. Logging off on the other hand will kill the apps running in that session.

What is your o/s server running?

EJB
Definitely disconnecting, other apps are running on there. Also that is kind of eliminated with the Windows Service, so perhaps its nothing to do with the terminal services!
MrEdmundo
A: 

In Order to solve the problem that you have described you need to focus in on what your problem is.

I have recieved the Message: CrystalDecisions.Shared.CrystalReportsException: Load report failed a number of times and it is due to the fact that you can't access the report. Either it doesn't exist or in your situation the you are not connected to the machine. The error is not due to anything printing related.

runxc1 Bret Ferrier
Hi I appreciate the answer but neither of the possibilities you mentioned are possible. The code works 99% of the time with no Load errors. Nothing is different between the failures trust me, I've checked everything I can think of to try and find a defining reason.
MrEdmundo
+1  A: 
Paul Williams
Oops. *Now* I read your comment about having solved the issue with a printer driver upgrade. Oh well!
Paul Williams
Hi, thanks for your response, I'm trying what you suggested now. I was wrong it had nothing to do with the Printer. I've marked my response for deletion. I am using VS2008 though, however I think what you've suggest still applies.
MrEdmundo
A: 

Even I get this 'Load report failed' error. Everytime we had to restart IIS services. Then it starts working again. Still searching for the answer!!!!

Vijay
A: 

After long googling i found this link but didnt try, coz of no any other free server.

http://www.microsoft.com/technet/security/bulletin/ms04-017.mspx

Saurin : [email protected]

A: 

I had an obscure issue that was similar to this, except it was a (shock-horror) automation issue with Excel. I found the application worked fine when I had my remote desktop session connected, but once disconnected, it would give automation errors relating to the default printer.

I believe the issue relates to how the default printer is set when you connect with remote desktop. Assuming you have a .rdp file for initiating your remote desktop session, if you edit it, then select the "Local Resources" tab, you can see whether or not you share your local printer on the remote session.

If it is enabled, this means when you connect, your local default printer becomes the default printer on the remote machine. When you disconnect, your application's default printer will still possibly refer to the now unavailable default printer from your local machine.

You should be able to solve this, by ensuring you don't share your local printer, by deselecting the Printer checkbox from the "Local Resources" tab.

An easier solution would be to disable "printer redirection" on the server. See http://serverfault.com/questions/5646/how-do-i-disable-remote-printers-using-group-policy for more information.

David Sitsky
A: 

Hi

If you are looking in detail how to

add checkboxes into crystal reports on a boolean feild and if the boolean field is false

uncheck else check the checkbox look at this article

http://checkboxcrystalreport.blogspot.com/2009/07/printing-checkbox-in-crystal-report-for.html

A: 

Our particular problem has been solved. Basically when the reports were created they were saved with information about printers. Basically a particular printer had been set for the report and saved.

This printer no longer exists which is why the report had started failing. Basically we had to open the report designer and remove any association with printers in the report.

MrEdmundo