“指定的打印机无效”适用于64位服务器的32位Windows服务

“指定的打印机无效”适用于64位服务器的32位Windows服务

问题描述:

大家好,



我在使用水晶报告时遇到了一些问题。



我的开发环境:

Visual Studio 2008,32位Windows XP



运行环境:
Windows Server 2003 Service Pack 2 64位

Crystal Reports Visual Studio 2008的基本运行时(x86)



我创建了两个应用程序:一个是控制台应用程序,一个是
Windows服务。两个应用程序都运行相同的代码来打印水晶
报告到打印机并以32位运行。我可以运行多个
控制台应用程序实例,没有任何问题。当我运行windows
服务版本时,第一次服务工作正常。但在
重新启动Windows服务器之后,水晶报告抛出
Sysstem.Runtime.InteropServices.COMException。



异常的细节是:


System.Runtime.InteropServices.COMException(0x80000201):

指定的打印机无效。

at CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass .ModifyPrinterName(String newVal)

at CrystalDecisions.CrystalReports.Engine.PrintOptions.set_PrinterName(String value)

at Company.PrintReport(ReportClass report,String printerName)



控制台应用程序和Windows服务都以32位运行。用户
运行该服务的是具有管理员权限的域控制器。并且
同样的问题发生在同一
服务器的IIS上托管的Web应用程序上。



到目前为止我做了什么:



1.将报告中的打印机选项设置为无打印机

2.尝试安装水晶报告x64

3.对于windows x86的服务构建。

我发现的另一件事是,如果服务停止一段时间(20分钟)然后重新开始,问题就会消失。



请有人帮助我。



干杯

Hi All,

I'm having some issues with crystal reports.

My development environment:
Visual Studio 2008, 32bit Windows XP

Running environment:
Windows Server 2003 Service Pack 2 64 bit
Crystal Reports Basic Runtime for Visual Studio 2008 (x86)

I've created two applications: one is console application and one is windows service. Both application run same codes to print crystal reports to printers and run at 32 bit. I can have multiple instance of console application running without any issues. When I run the windows service version, the first time the service works fine. But after I restarted the windows server, the crystal report throw Sysstem.Runtime.InteropServices.COMException.

The detail of the exception is:

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 Company.PrintReport(ReportClass report, String printerName)

Both console application and windows service run at 32 bits. The user runs the service is domain controller who has admin permission. And the same problem happened on an web application hosted on IIS of the same server.

What I've done so far:

1. Set the printer option in the report to no printer
2. Try install the crystal report x64
3. For the windows service build for x86.

Another thing I found was that if the service is stopped for a while (20 mins) then start again, the problem goes away.

Please some one help me in this.

Cheers

这听起来像序列化给我和我相信Crystal的reportdocument对象不可序列化。此外,一次只能打开3个报告实例。

如果我们要删除在查看报告期间创建的临时文件,另一件事就是检查Temp文件夹。
Well it sounds like serialization to me and I believe Crystal's reportdocument object is not serializable. Also at one time only 3 instances of a report can be opened.

Another thing would be to check the Temp folder if we are removing the temp files that gets created during viewing a report.