views:

130

answers:

2

I have got a windows service written in .NET and I need to be able to implement a self-restarting feature for it.

E.g. service constantly monitors the environment in runs in and once a value of the environmental variable reaches its threashold value the service must restart itself.

What would be the easiest way to do it?

+3  A: 

Write a Service to start the Service!

Ken Browning
Simple as it sounds, that's the common approach I have seen.
Eric J.
Heh, reminds me of this - http://www.csd.uwo.ca/~magi/personal/humour/Computer_Folklore/Robin%20Hood%20And%20Friar%20Tuck.html
Erik Forbes
You don't need to have 2 services unless you are supporting windows 98 or earlier.
Byron Whitlock
@Erik, cool anecdote!
Byron Whitlock
+5  A: 
Byron Whitlock