服务启动/停止其他服务需要哪个用户许可? [英] Which user permission does a service need to start/stop other services?
问题描述
我写了一项服务,应该启动/停止其他服务. 这是我正在使用的代码:
I've wrote a service that should start/stop other services. This is the code I'm using:
ServiceController sc = new ServiceController("servicename");
if(sc.Status != ServiceControllerStatus.Running)
{
sc.Start();
}
这是异常的调用堆栈. (抱歉,该消息是德语本地化的,但这与理解我的问题无关)
This is the callstack of the exception. (Sorry, but the message is localized in german, but that's not relevant for understanding my problem)
System.InvalidOperationException: Der Dienst SCardSvr kann nicht auf dem
计算机. geöffnetwerden. --->
System.ComponentModel.Win32Exception:
Zugriff Verweigert
--- Ende der internenAusnahmestapelüberwachung---
bei System.ServiceProcess.ServiceController.GetServiceHandle(Int32
requiredAccess)
bei System.ServiceProcess.ServiceController.Start(String []
args)
bei System.ServiceProcess.ServiceController.Start()
Computer . geöffnet werden. --->
System.ComponentModel.Win32Exception:
Zugriff verweigert
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.ServiceProcess.ServiceController.GetServiceHandle(Int32
desiredAccess)
bei System.ServiceProcess.ServiceController.Start(String[]
args)
bei System.ServiceProcess.ServiceController.Start()
当前,我正在网络服务"下运行该服务.我想该帐户不能满足必要的用户权限.
我将创建一个新用户,该用户具有启动/停止任意服务所需的最小权限.
这个新的用户帐户需要什么权限?
Currently I'm running the service under 'Networkservice'. I guess that account does not suffice the necessary user rights.
I'm going to create a new user that the most minimal permission required to start/stop arbitrary serivces.
What permissions does this new useraccount need?
推荐答案
是否需要启动和停止任意服务或特定服务集?
Does it need to be able to start and stop arbitrary services, or a specific set?
要获得更精细的控制,您可以设置对特定服务的权限.参见 http://msmvps.com/blogs/erikr/archive/2007/09/26/set-permissions-on-a-specific-service-windows.aspx?CommentPosted=true#commentmessage
For more fine grained control you can set permissions against a specific service. See http://msmvps.com/blogs/erikr/archive/2007/09/26/set-permissions-on-a-specific-service-windows.aspx?CommentPosted=true#commentmessage
高级用户"组的成员具有启动和停止服务的能力.请参阅 http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/windows_security_default_settings.mspx?mfr=true
Members of the 'power users' group have some ability to start and stop services. See http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/windows_security_default_settings.mspx?mfr=true
这篇关于服务启动/停止其他服务需要哪个用户许可?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!