.Net Crystal Report print application running on connection errors with a terminal service when a session is disconnected

I created a .NET application to run on an application server that receives report requests and prints the requested report.

The C # application uses Crystal Reports to download the report and print it out later.

The application runs on the server to which the remote desktop connection is connected under a specific user account (required for older applications). When I disconnect from the Remote Session, the application begins to throw exceptions, such as:

Message: CrystalDecisions.Shared.CrystalReportsException: Report loading error

This type of error never occurs with an active remote session. The server on which the application is running is running Windows Server 2003, my field that creates the connection is Windows XP.

I understand that this is rather strange, however, I see no problems with creating the application that I created.

Does anyone know what could be causing this problem?

EDIT: I removed the bullet and created the application as a Windows service, it is obvious that this will not take much time, I just was not sure that this would solve the problem. In any case, this is not so.

I also tried to remove the multi-threaded code that asynchronously called the print function. I did this to just an application and narrow down the reason why it might fail. In any case, this also did not improve the situation!

EDIT: Two errors I get:

System.Runtime.InteropServices.COMException (0x80000201): Invalid printer specified. in CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.ModifyPrinterName (String newVal) in CrystalDecisions.CrystalReports.Engine.PrintOptions.set_PrinterName (String value) with Dsa.PrintServer.Service.Service.Print Report

The printer is not invalid, this is confirmed when after 60 seconds the time is ticking and the report prints successfully.

and

The request could not be sent with background processing. in CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.GetLastPageNumber (RequestContext pRequestContext) in CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber (ReportPageRequestContext.ReportDotErnterectrecessStreetStrecessStrectureStreckStreamStrecessStrectureStreckStreetReportStrecessStream EromReportSourceBase.GetLastPageNumber (ReportPageRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter (Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) CrystalPrementPricePrintPricePrintPricePrint.RenReportPrint.Prevent.EntreReport.EntreReport. Int32 endPageN) at Dsa.PrintServer.Service.Service.PrintCrystalReport (Report Report)

EDIT:

I ran the mon file to check if there is a problem with access. At the moment when an error occurs with mon reports files

Request: OPEN | Path: C: \ windows \ assembly \ gac_msil \ system \ 2.0.0.0__b77a5c561934e089 \ ws2_32.dll | Result: NOT FOUND | Other: Attribute Error

+4
source share
8 answers

Our specific problem has been resolved. Basically, when the reports were created, they were saved with information about printers. Basically, a specific printer was set up for the report and saved.

This printer no longer exists, so the report started to crash. Basically, we had to open the report designer and unlink the printers in the report.

+2
source

We have encountered these errors several times over the past few years. Many times I wanted to get a more specific error message.

First, I would make sure that several versions of Crystal Reports are not installed. In our experience, we found that Crystal Reports 9.0 does not seem to play well with 10. Uninstalling version 9 seemed to help some of our clients. If both are installed, I highly recommend uninstalling both and then reinstalling Crystal Reports 10.

One of our earliest Crystal Reports errors was terrible: "The request could not be sent for background processing." Reports will work fine, and suddenly they will stop. Looking at the code, I found a place where we did not dispose of ReportDocument. Correctly deleting this document fixed the problem.

Recently, we click "Request could not be sent for background processing." and "Invalid printer." One client server had several network printers identified by IP address. For a while, printing will work fine, and then suddenly, bam, the client received an "Invalid Printer" error and called our support.

Another developer fixed the Invalid Printer problem by following these steps:

  • Edit and save the .rpt file in Visual Studio 2005. We kept the report format compatible with Crystal Reports 9 because we wanted our changes to apply to our clients still using older versions.
  • Save Crystal Reports files with No Printer. From the Visual Studio 2005 menu, select “Crystal Reports / Design / Printer Setup,” then check the “No Printer” box.
  • We changed the formula that displayed “Page N of M” from something strange:

 "Page " + Left (CStr (PageNumber), Length (CStr (PageNumber)) - 3) + " of " + Left (CStr (TotalPageCount), Length (CStr (TotalPageCount)) - 3) 

code>

:

 "Page " + CStr(PageNumber,0) + " of " + CStr(TotalPageCount,0) 

Unfortunately, I have no idea which (any or all) of the above actions can resolve the error. I say “maybe” because, as far as I know, the error magically disappeared due to a change in the IT network.

Finally, have you read this white paper? Although this did not necessarily solve our problems, it was very interesting.

+1
source

If you create a wrapper for a window application for your application, this means that it will continue to work regardless of the user's login. It can also be configured to start automatically. I think that since you are using the actual application, not the Windows service, it does not actually start after leaving the session on the server.

Here is a sample code project:

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

0
source

You are sure that you are "disconnecting" the remote session, and not "logging out". I always disconnect my sessions to the nt server and everything that needs to be continued is just fine. kill applications running in this session.

How does your o / s server work?

0
source

In order to solve the problem that you described, you need to focus on what your problem is.

I received the Message: CrystalDecisions.Shared.CrystalReportsException: Error loading the report several times, and this is due to the fact that you cannot access the report. Either this does not exist, or in your situation you are not connected to the machine. The error is not related to anything related to printing.

0
source

After long searches, I found this link, but have not tried it, it has no other free server.

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

0
source

I had an unclear problem that was similar to this, except that it was an automation problem (shock-horror) with Excel. I found that the application works fine when I connected a remote desktop session, but after disconnecting it, it will generate automation errors related to the default printer.

I believe the problem is with how the default printer is installed when connecting to Remote Desktop. Assuming you have a .rdp file to start a remote desktop session, if you edit it, then select the Local Resources tab, you can find out if you are using a local printer in a remote session.

If it is turned on, it means that when connected, your local printer defaults to become the default printer on the remote computer. When you turn off the default printer for your application, it will still refer to a default printer that is not available from your local computer.

You must solve this problem by making sure that you are not using your local printer by unchecking the "Printer" checkbox from the "Local Resources" tab.

A simpler solution would be to disable “printer redirection” on the server. See https://serverfault.com/questions/5646/how-do-i-disable-remote-printers-using-group-policy for more details.

0
source

If you look in detail how

add flags to crystal reports on logical feild and if the logical field is false

uncheck to check the box in this article

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

0
source

All Articles