开发者

ServiceController starts Manual StartType only but not Automatic

I have a service installed, and I am trying to start it with the code below:

ServiceController serviceController = new ServiceController("My.Service");
serviceController.Start();

Now if the Service is set with a StartType of "Manual", thi开发者_如何学Cs works perfectly. However if the StartType is set to "Automatic", it does nothing. No errors, no exceptions, it just does not work.

How do I get around this?


if the service can run in manual mode, consider the other controllable aspects of the service, such as the account under which the service executes (LocalSystem or some other account?).

Please set the account type to local service during edit of windows service as below:

    1.Right click ServiceProcessInstaller1 and go to the properties tab

        a.Change the account to "LocalService"

   2. Save and try it.

Hope this will help you........

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜