简体   繁体   English

与域用户启动Windows服务给出:错误5:访问被拒绝

[英]Starting Windows Service with Domain User Gives: Error 5: Access is Denied

I have a Topshelf Windows Service that installs and starts just fine when I run it as local system . 我有一个Topshelf Windows服务,可以在将其作为local system运行时安装并启动正常。

But when I switch to a domain user (or network service ), I get the following error: 但是当我切换到域用户(或network service )时,出现以下错误:

Windows could not start the My Cool Custom Service service on Local Computer. Windows无法在本地计算机上启动My Cool Custom Service服务。

Error 5: Access is denied. 错误5:访问被拒绝。

I am left wondering if it is my domain user that I am running the service as that does not have permissions, or if it is me personally that does not have permissions to start a service as a non Local System user. 我只是想知道是我的域用户在运行该服务,因为它没有权限,还是我个人没有权限以非Local System用户的身份启动服务。

How can I get this service to start up? 我如何才能启动此服务?

NOTES: 笔记:

Things I have tried: 我尝试过的事情:

  • Granting the domain user full access to the folder that has the binaries. 授予域用户对具有二进制文件的文件夹的完全访问权限。
  • Running SubInAcl.exe to grant the domain user permissions to the service. 运行SubInAcl.exe授予域用户对该服务的权限。
  • Running SubInAcl.exe to grant me permissions to the service. 运行SubInAcl.exe授予我对该服务的权限。
  • Starting the service from a console that has admin permissions: 从具有管理员权限的控制台启动服务:
    • TopShelf CLI Command Run: MyCoolService.exe start TopShelf CLI命令运行: MyCoolService.exe start
    • Error: The service failed to start., System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed. 错误: The service failed to start., System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed.

I decided to try to work around this by running as Local System and then impersonating the user I want to make my calls. 我决定尝试通过作为Local System运行,然后假冒我要拨打电话的用户来解决此问题。

Well, turns out that this issue is that my Windows Service starts up a self hosted SignalR service at startup. 好吧,事实证明,这个问题是我的Windows服务在启动时启动了自托管的SignalR服务。 That call is what was giving the Access is Denied error. 该呼叫正是导致“ Access is Denied错误的原因。

If I let Local System start the SignalR service then do the rest of the stuff with my domain user it works fine. 如果我让Local System启动SignalR服务,然后与我的域用户一起完成其余工作,则它可以正常工作。

(I will likely post a question on how to grant my user rights to start a SignalR service...) (我可能会发布有关如何授予我的用户启动SignalR服务的权限的问题...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM