C#

C#,重起某个服务 Service

最近在编写一个对Winodows 服务的监控,需要定时重起服务,然后发现System.ServiceProcess简单又好用,方法如下,

using System.ServiceProcess;

//—例如我重起文件共享的服务”Server”
RestartServices(“Server”);

 

Pls call me CPP.
Posts created 150

发表评论

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top