当Windows服务运行OPOS PosExplorer.GetDevice()返回null [英] OPOS PosExplorer.GetDevice() returns null when executed in Windows Service
问题描述
在code段下面利用OPOS .NET中打开一个POS打印机进行打印。当作为一个独立的应用程序的一部分执行它工作正常。当Windows服务调用的getDevice(...)执行始终返回null。
The code snippet below makes use of OPOS .NET to open a POS printer for printing. It works fine when executed as part of a standalone application. When executed by a Windows Service the call to GetDevice(...) always returns null.
explorer = new PosExplorer();
device_info = explorer.GetDevice(DeviceType.PosPrinter, PrinterName);
printer = (PosPrinter)explorer.CreateInstance(device_info);
printer.Open();
printer.Claim(1000);
printer.DeviceEnabled = true;
打印机恰好是一个爱普生TM-U220B。有一个需要克服之前一个服务访问POS装置一个安全问题?谁能推荐关于使用OPOS .NET Windows服务的发展一个很好的信息来源?
The printer happens to be an Epson TM-U220B. Is there a security issue that needs to be overcome before a service has access to POS devices? Can anyone recommend a good source of information regarding the development of Windows Services that use OPOS .NET?
推荐答案
嗯OPOS,它已经有一段时间...;)
Ah OPOS, it's been a while ... ;)
这听起来像安全性。测试的方式,如果它是: 1.运行下,你知道从独立的应用程序作品的用户帐户服务 2.检查设置的服务配置,允许它与桌面交互。
It sounds like security. The way to test if it is: 1. Run the service under a user account that you know works from the standalone app 2. Check the setting in the service configuration that allows it to interact with the desktop.
这篇关于当Windows服务运行OPOS PosExplorer.GetDevice()返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!