Win32Exception StandardPrintController OnStartPrint
我在 Windows 服务中有一个托管服务,该服务负责打印我发送的某些信息。
因此,在调试时不会发生错误,我必须以管理员身份启动 VS。
但是在生产中,当我调用 .Print() 时,我收到消息“系统找不到指定的文件”,并且我的堆栈跟踪显示:
at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing。 Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
到目前为止,据我所知,这是由权限问题引起的。
我已经将我的 Windows 服务作为其属性的完全信任。我还在托管该服务的程序集中添加了一个清单文件。
打印机有效,我可以从任何其他程序(Word、Excel)进行打印。我还选中了“允许与桌面交互”并重新启动了服务。
有什么想法吗?
I have a hosted service inside a Windows Service, this service is in charge of printing certain info I send.
So while debugging the error won't happen, I have to start my VS as an Administrator.
But in Production when I call .Print() I get the message "The system cannot find the file specified" and my stacktrace says:
at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
So far from what I have read is this is caused by a permission issue.
I already put my Windows Service as a Full Trust on its properties. I also added a manifest file on the assembly that is hosting the service.
The printer is valid and I'm able to print from any other program(Word,Excel). I also checked "Allow to interact with the desktop" and restarted the service.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否在服务的“登录”选项卡上指定帐户?您可能需要提供一个可以正常访问打印机的帐户。更多详细信息,请参阅我们的Windows 服务常见问题解答。
Are you specifying an account on the service's LogOn tab? You probably need to provide an account that can access the printer normally. More details in our Windows Services FAQ.