简体   繁体   English

Topshelf 服务以哪个身份运行?

[英]Which identity is Topshelf service running as?

There appears to be two ways to specify the identity a Topshelf service.似乎有两种方法可以指定 Topshelf 服务的身份。 One is in code like these examples:一个是像这些例子一样的代码:

configure.RunAsLocalSystem();
configure.RunAs("MYDOMAIN\username", "password");

And then there is the user specified in the Services application in Windows, where you right click on the service and select Properties and go to the Log On tab.然后是在 Windows 的服务应用程序中指定的用户,您可以在其中右键单击该服务并选择“属性”并转到“登录”选项卡。

Which of these takes precedence?其中哪个优先? Or are they relating to different things?或者它们与不同的事物有关?

服务登录窗口

They refer to the same thing.他们指的是同一件事。 Topshelf and Services.msc are manipulating the underlying windows service entity. Topshelf 和 Services.msc 正在操作底层的 Windows 服务实体。

Both methods will ultimately use the ChangeServiceConfig API function to set the service's the user name and password (or possibly CreateService , when TopShelf is creating).这两种方法最终都将使用ChangeServiceConfig API 函数来设置服务的用户名和密码(或者可能是CreateService ,当 TopShelf 创建时)。

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

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