ServiceController.start() and ServiceController.stop() are throwing exceptions?

前端 未结 5 1541
野趣味
野趣味 2021-01-21 07:43

The following code is throwing Exception. I don\'t get what mistake I am making in the code. Can somebody help me figure out please. I think it is of some security rights issue.

5条回答
  •  野的像风
    2021-01-21 08:27

    You can use the subinacl tool for that

    SUBINACL /SERVICE \\MachineName\ServiceName /GRANT=[DomainName\]UserName[=Access] 
    

    To be specfic for your case:

    subinacl /service DataLoad /GRANT=YOURDOMAIN\[User in appdomain for WEBSITE]=TO
    

    Where TO means
    T : Start Service
    O : Stop Service

    all options for [Access] are:

    F : Full Control
    R : Generic Read
    W : Generic Write
    X : Generic eXecute
    L : Read controL
    Q : Query Service Configuration
    S : Query Service Status
    E : Enumerate Dependent Services
    C : Service Change Configuration
    T : Start Service
    O : Stop Service
    P : Pause/Continue Service
    I : Interrogate Service
    U : Service User-Defined Control Commands

    See Method 3 in this kb article

提交回复
热议问题