带有窗口服务的网络打印
我有一个朋友用窗口窗体做了同样的事情。
我需要的是将其作为窗口服务。
Window服务程序(打印控制器服务)将用作中央打印机控制器。
根据情况,我将打印作业发送到网络上的不同打印机(打印机安装在USB上)。 已经可以进行测试打印,但是当我列出已安装的打印机时,这些网络打印机未列出。
但在我朋友的程序中,他所需要做的就是将打印机名称设置为机器的IP地址,并且对于该机器,只需确保将其设置为默认打印机即可。
一旦我的朋友设置了IP地址并触发打印,它将被打印到正确的打印机。但就我而言,窗口服务已经没有列出网络打印机,如果打印机名称错误,它不会打印。
对于我的窗口服务,我使用的是本地系统。
听说过使用打印机的相关 IP 地址创建本地端口,但尚未进行测试。
希望有人能够给予一些指导
I have a friend who did the same thing with window form.
What I need is to make this to a window service.
The Window service program (printing controller service) will be used as a central printer controller.
Depending on the condition, I will send the printing job to different printer on the network (the printer is installed on USB).
It is already possible to do a test print, but when I list down the installed printers, these network printers are not listed.
But in my friend's program, all he need to do is to set the printer name to the ip address of the machine, and for that machine, just make sure that it is set to the default printer.
Once my friend set the ipaddress and trigger print, it will be printed to the correct printer. But for my case, the window service already did not list down the network printers, it will not print if printer name is wrong.
For my window service, I'm using Local System.
heard about creating a local port with the relevant IP address of the printer, but have yet to manage to test.
Hope that someone is able to give some guidance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不建议从 Windows 服务打印。 Windows 服务在后台运行,没有 UI。
您可以查看:
在 C# 中从 Windows 服务打印 html 文档,无需打印对话框
编辑
我想您需要使用不同的帐户< /a> 为您的服务(域帐户)以便您可以访问网络资源。
Printing from a windows service is not recommended. Windows service runs in background and have no UI.
You can look into:
Print html document from Windows Service in C# without print dialog
EDIT
I guess you need to use a different account for your service,( domain account) so that you can access network resources.
有点放弃使用窗口服务,因为当我登录计算机可以访问的打印机时,它只会显示本地安装的打印机,而这些网络打印机无法以某种方式识别。
尝试使用标准 TCP/IP 端口,设置没有问题,但甚至无法进行测试打印。
决定权衡使用窗口形式,根据映射设置默认打印机并发出打印命令。经过测试,它有效。这样,用户每天只需登录电脑即可,但好处是不存在需要额外设置权限和访问权限的问题。
Have sort of gave up on using window service, as when I log down the printers my computer can access, it will only show only those installed locally, those network printers are not recognized somehow.
Tried with standard TCP/IP port, have no problems setting up, but unable to even do a test print.
Decided to trade off by using window form, setting the default printer according to the mapping and issue a print command. Tested and it worked. This way, the user will only need to login the computer each day, but the advantage is that there will be no issue for the need of additional settings with regards to permission and access rights