如何使用C#获取服务的启动类型

时间:2018-02-25 13:44:31

标签: c# windows-services

由于我的客户不习惯使用Windows服务屏幕,我想知道如何才能获得服务的启动类型。

1 个答案:

答案 0 :(得分:1)

就像使用StartType类的ServiceController属性一样简单:

ServiceController sc = new ServiceController("Simple Service");
Console.WriteLine(sc.StartType.ToString());

其中"简单服务"是您想要获取详细信息的服务的名称。

可以找到使用此类的更多示例here.

相关问题