ServiceController sc = new ServiceController("TlntSvr"); //这个是Telnet
if (sc.Status.Equals(ServiceControllerStatus.Stopped))
{
sc.Start();
}
else
{
sc.Stop();
}
if (sc.Status.Equals(ServiceControllerStatus.Stopped))
{
sc.Start();
}
else
{
sc.Stop();
}