Restarting Services

  • Thread starter Thread starter Jarrod Morrison
  • Start date Start date
J

Jarrod Morrison

Hi All

This might sound really stupid and be impossible but i am wondering if a
service can restart itself by code without using any external programs ? Any
help is greatly appreciated

Thanks
 
Jarrod Morrison said:
Hi All

This might sound really stupid and be impossible but i am wondering if a
service can restart itself by code without using any external programs ?
Any
help is greatly appreciated

In theory, if the service has stopped then the program is no longer running,
so it can't restart itself...
There may be ways around this of course - i.e. if the program also has a
forms front end that stays running it could stop and start its own service
itself - but I'm guessing here. And services wouldn't normally have a front
end anyway.
The services control panel screen allows you to tell a service to restart if
it stops unexpectedly (or various other actions) so if that's the problem,
take a look there.
James.
 
Jarrod,
As James suggests, the Service itself has stopped running so it cannot
possibly restart itself.

However there are two options that I know about.

1. Create a 2nd service that watchs the first. If the first ends then have
the second start it again.
2. Use the Services properties (in "Computer Management - Services") to set
the Recovery of the service. You can set what happens on the First Failure,
the Second Failure, and Subsequent Failures.



--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Hi All
|
| This might sound really stupid and be impossible but i am wondering if a
| service can restart itself by code without using any external programs ?
Any
| help is greatly appreciated
|
| Thanks
|
|
 

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

Similar Threads

New Version Windows 10 13
Windows 7 Problem with Services 4
Computer Crashing 8
Service restart itself? 3
Can I write this program? 9
inconsistent results with different methods of executing file 7
Windows 7 Win7 hangs 2
Windows service (Restart itself) 14

Back
Top