Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start/Stop of Windows service from a web app, not possible right? 1

Status
Not open for further replies.

StuckInTheMiddle

Programmer
Mar 3, 2002
269
US
You guys often seem to have answers to the impossible so here's a puzzler for you.

I have a user that wants me to give him permission to a start/stop a windows service via a web page. I have to imagine that such a thing isn't possible, I know we could programmatically do something with a .NET console app on the actual box. But this guy doesn't have remote desktop access to the box, he wants the ability to do this remotely via the web, and only him of course, woulnd't be good if anyone could just go to the webpage and stop the service ;)

Is the Windows Service exposed as an API to .NET web, the web app will sit on the same box as the windows service.




"If you can stay calm, while all around you is chaos...then you probably haven't completely understood the seriousness of the situation.
 
System.Dianostics.Process.Start("file.bat");
in file.bat setup the commands to start the service.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks Jason, I was able to use that, never thought of calling a batch file.

I would still be interested to know if the windows service is accessible through a .NET library directly or an API call, so I could get a response to know if it worked or not. But this should keep him happy, for now :)

"If you can stay calm, while all around you is chaos...then you probably haven't completely understood the seriousness of the situation.
 
System.ServiceProcess namespace. See ServiceController class and its Start & Stop methods etc.
 
Try running this as a non-admin user to make sure it works on a production machine.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top