Jun
29
首先先引用System.ServiceProcess.dll
然后在引用命名空间using System.ServiceProcess;
ServiceController sc = new ServiceController("Server");建立服务对象
//服务运行则停止服务
if (sc.Status.Equals(ServiceControllerStatus.Running))
{
sc.Stop();
sc.Refresh();
}
//服务停止则启动服务
if ((sc.Status.Equals(ServiceControllerStatus.Stopped)) || (sc.Status.Equals(ServiceControllerStatus.StopPending)))
{
sc.Start();
sc.Refresh();
}
然后在引用命名空间using System.ServiceProcess;
ServiceController sc = new ServiceController("Server");建立服务对象
//服务运行则停止服务
if (sc.Status.Equals(ServiceControllerStatus.Running))
{
sc.Stop();
sc.Refresh();
}
//服务停止则启动服务
if ((sc.Status.Equals(ServiceControllerStatus.Stopped)) || (sc.Status.Equals(ServiceControllerStatus.StopPending)))
{
sc.Start();
sc.Refresh();
}
est
2010/03/09 17:40
Buy and world of warcraft gold
g
2009/09/15 13:04
I think wow power leveling
ch
2009/04/09 15:54
























分页: 1/1
1
1
对WinForm的App
windows服务安装后



