c# - Designing a Process Monitor Windows Service -
i'm designing windows service maintains list of processes. can run tasks on them. example - stop specific process (within list), restart specific process, run new process , add list, etc.
this windows service controlled web app, through wcf service - windows service runs wcf service, , web app connects wcf service. wcf service exports methods such restart(int id) , stop(int id).
i have several questions:
when process unexpectedly closes (for example, because of internal error), service should update value in database. right now, this, i'm having thread every 30 seconds checks if process running or not.
is right this? should use
exitevent?when service closes, any reason, all of processes maintains shall close too. right way this?
i thinking loop through list , kill processes when service's
onclose()called. problemonclose()event not being called. example, if service unexpectedly closes? won't callonclose().how should represent each task (for example - restart process or stop process)?
right i'm using
system.threading.tasks. right way?
this service should highly scalable, minimum mistakes.
thanks.
for closing processes when service closes, think following steps can job you.
- write small program can close processes want close.
- go service control manager , right click on service.
- go recovery tab , specify program execution under first failure, second failure , subsequest failure listboxs.
hope help.
Comments
Post a Comment