How to start Windows services from C# code

N

nivedita

I got below function from http://techinterviewquestion.blogspot.com/
blog. it is working fine. i used

public void StartService(string ServiceName)
{
ServiceController sc = new ServiceController(ServiceName);
if (sc != null && sc.Status == ServiceControllerStatus.Stopped)
{

sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running);

}
}
 
J

Juan T. Llibre

re:
!> do you have an issue with ASP.NET...?

Nah. He's spamming this newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top