c# 写了一个windows服务程序, 如何实现让windows 服务本身实现重新启动?
如题:
知道以下方法可以实现服务得重启或停止。
ServiceController sc = new ServiceController();
sc.ServiceName = "ShortMessage";
sc.Start();//启动服务
sc.Stop();//停止服务
但如果在服务中先调用 sc.Stop();//停止服务 后,程序退出,执行不到 sc.Start();//启动服务
不知各位大侠有和方法??