Command line Windows服务调用需要用户登录的命令行应用程序

Command line Windows服务调用需要用户登录的命令行应用程序,command-line,windows-services,registry,Command Line,Windows Services,Registry,我的Windows服务运行第三方命令行应用程序时出现问题 但是,命令行应用程序会尝试访问HKEY_当前用户注册表项。因此,命令行引发以下异常: System.IO.IOException: Illegal operation attempted on a registry key that has been marked for deletion. at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)

我的Windows服务运行第三方命令行应用程序时出现问题

但是,命令行应用程序会尝试访问HKEY_当前用户注册表项。因此,命令行引发以下异常:

System.IO.IOException: Illegal operation attempted on a registry key that has been marked for deletion. 

at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) 
at Microsoft.Win32.RegistryKey.SetValue(String name, Object value, RegistryValueKind valueKind) 
at Microsoft.Win32.RegistryKey.SetValue(String name, Object value) 
at ACMEApp.Settings.GetValue(String name, Object def) in SomeClass.cs:line 542 
该服务配置为在计算机上具有管理员权限的专用域用户帐户下运行

我有一个解决办法,就是让运行服务的用户登录到机器上。这远非理想。其他用户已登录到机器并注销该用户,导致问题再次出现。我不能让第三方改变他们的代码,虽然它是为了能够从我的服务运行。这也会挂起控制台应用程序

我需要一些思考如何解决这个问题。有没有一种方法可以让它发挥神奇的作用,或者更好地让错误报告变得更加明显


目前,服务只是记录到一个日志文件中,当用户报告事情没有工作时,该文件中的故障点就是。

您是否尝试以用户身份运行该服务?抱歉,该服务已配置为以特定域用户身份运行。我更新了问题以反映这一点。