views:

269

answers:

4

Is it possible to create a windows service which will be unstoppable until the machine gets shutdown. Because I want to run one of my applications along with the service, is it possible to do it?

Thanks, just tell me how to run my application along with the service.

A: 

One way is to set up another service, or a scheduled task, that monitors the services and restarts it.

The value of this approach would really depend on the nature of your tasks. I've seen this approach used to keep a slightly unstable service alive (it was a legacy system and the team didn't have the time to rewrite it immediately, so they used this as a band-aid).

dommer
+2  A: 

So what your asking for is a windows service that cannot be terminated until Windows is closed down, then you want to know if there is a way to attach a program to that service so that it cannot be terminated as well?

I could be wrong, but I doubt if windows would give you the opportinity to create and attach a program to a service which would make it impossible to kill, unless you pulled the plug. i'm guessing you would have to write some sort of extra program to monitor the current one so that it could restart it, if it got closed down.

kevchadders
You cannot create a process that is un-killable in Windows. Otherwise Windows would do this to critical processes (kill csrss.exe for a quick BSOD). With careful setting of service and process ACLs you can make it harder, but this can always be beaten with Take Ownership and Debug privileges.
Richard
@Richard: You should post this as an answer. It is the correct answer but I can't up vote it.
Stephen Martin
+3  A: 

You cannot create a process that is un-killable in Windows. Otherwise Windows would do this to critical processes (kill csrss.exe for a quick BSOD). With careful setting of service and process ACLs you can make it harder, but this can always be beaten with Take Ownership and Debug privileges.

Richard
A: 

Hi RV.

As others (particularly Richard) have pointed out, it is virtually impossible to make a Windows process "un-killable".

If your goal is to run your application 24/7, I suggest using a product like AlwaysUp, which will start your application as a service, closely monitor it, and quickly fire it up again if it fails for any reason.

Good luck!

CoreTech