错误"设置访问打印机的PrinterName“是无效的"从Windows服务打印时打印机、错误、Windows、QUOT

2023-09-03 00:39:14 作者:执笔写下情

打印到网络打印机,当我提到的错误。

I get the error mentioned when printing to a network printer.

该错误并不在XP / Win2003的运行时或发生在一个WinForm应用程序时使用本地打印机。

The error does not occur when run under XP/Win2003, in a WinForm app or when a local printer is used.

当为在Vista / Win7的/ Win2008的Windows服务和打印到网络打印机运行错误不会只发生。

The error does only occur when run as a Windows Service under Vista/Win7/Win2008 and printing to a network printer.

Windows服务在具有访问网络打印机的网络用户运行。在我印我检查的PrinterName(包括网络路径)是确定的,通过可用的打印机循环。

The Windows service runs under a network user that has access to the network printer. Before I print I check if the printername (including network path) is ok by looping through the available printers.

这又如何解决呢?

推荐答案

由通过注册表添加打印机系统用户黑客在微软的文档中描述解决:的 http://support.microsoft.com/kb/184291/en-us 。

Solved by adding the printer to the SYSTEM user via a registry hack as described in the Microsoft doc: http://support.microsoft.com/kb/184291/en-us.