.net 错误“设置访问打印机的打印机名称“是无效的”从Windows服务进行打印时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2722327/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 14:12:22  来源:igfitidea点击:

Error "Settings to access printer 'printername' are not valid" when printing from Windows service

.netprintingwindows-servicesnetwork-printers

提问by

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

我在打印到网络打印机时收到了提到的错误。

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

在 XP/Win2003 下运行、在 WinForm 应用程序中或使用本地打印机时不会出现此错误。

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

只有在 Vista/Win7/Win2008 下作为 Windows 服务运行并打印到网络打印机时才会出现该错误。

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.

Windows 服务在有权访问网络打印机的网络用户下运行。在打印之前,我通过循环访问可用的打印机来检查打印机名称(包括网络路径)是否正常。

How can this be solved?

如何解决这个问题?

回答by

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.

通过 Microsoft 文档中所述的注册表黑客将打印机添加到 SYSTEM 用户来解决:http: //support.microsoft.com/kb/184291/en-us

回答by efecetir

In my case we got same error for windows 10 os client computers. I think the error is related users and their permissions.

在我的情况下,我们在 Windows 10 操作系统客户端计算机上遇到了同样的错误。我认为错误与用户及其权限有关。

After making the client computers to our company's domain the error was fixed.

将客户端计算机连接到我们公司的域后,错误已修复。