Windows Service Application Restart

  • Thread starter Thread starter MikeZ
  • Start date Start date
MikeZ explained :
How Can Windows Service Application Reatarts itself? Thanks.

Control Panel > Administrative Tools > Services
select your service
right-mouse > properties
"Recovery" tab

Hans Kesting
 
I mean that write code in windows service application to restart itself. It
does not include to restart service from second application or command line.
 
Hi,

Do you realize the contradiction in your statement?
You want to write a code that stops itself and then restart again :)

Having said that, you can use an external process to do it. if your win
service spawn a process then this process can stop the service, do what you
need and restart the service.

You use ServiceControlManager for that.
 
For windows Application, it can restart itself by calling
ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)

As you said, if the service cannot do the job by itself, an extra process is
the best choice.

Thanks.
 
MikeZ said:
For windows Application, it can restart itself by calling
ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)

This does not restart an application, it restarts the system, you want to
restart the service, quite different isn't?
Restarting a Service is a feature that is OS version dependent, so what OS
are you running?

Willy.
 
Willy, I run Windows XP

Willy Denoyette said:
This does not restart an application, it restarts the system, you want to
restart the service, quite different isn't?
Restarting a Service is a feature that is OS version dependent, so what OS
are you running?

Willy.
 
Try with nr 2 answer, put it in autorestart and just die... (the
service, not u) it will restart, but fixing problems that way is not
recommended..
//CY
 
Hans said:
MikeZ explained :
Control Panel > Administrative Tools > Services
select your service
right-mouse > properties
"Recovery" tab
Hans Kesting

Is it possible to do this setting during install via batch (service
/install ?) and how? Thank you!

regards, Rudi
 
Back
Top