English 中文(简体)
哪些用户许可服务需要开始/停止其他服务?
原标题: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();
}

这是例外的指针。 (Sorry, but the information is localized in german, but that s not relevant for Understanding my problem)

System.InvalidOperationException: Der Dienst SCardSvr kann nicht auf dem

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?

最佳回答

是否需要能够开始和停止武断服务,或建立一套具体服务?

如果实行更细微的谷物控制,你可以针对某个特定服务进行许可。 见http://msmvps.com/blogs/erikr/archive/2007/09/26/set-permissions-on-a-specific-service-windows.aspx?CommentPosted=true#commentmessage”rel=“nofollow”http://msmvps.com/blogs/erikr/archive/2007/09/26/set-permissions-on-a-specific-service-windows.aspx?

电力用户群体成员有一些能力开始和停止服务。 见http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/windows_security_default_dings.mspx?mfr=true”rel=“nofollow”http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/windows_security_def_dings.mspx?mfr=true

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签