I have a console application that runs on my computer. When the application throws an exception, I want to restart the application. How can I accomplish this?
I have a console application that runs on my computer. When the application throws
Share
You can instantiate a Timer that check every n seconds if the process is alive, for example you can write i function like the following to verify if the process is alive :
Every Tick of the timer you can check if the process is alive or not, if not you can relaunch it.
Another method could be use a ManagementEventWatcher for get fired an event every time that a process stop on your machine, so for example :