views:

76

answers:

1

I am running a service program which is started multiple times with different configuration files passed on commandline. The program is started by a control program which is running as windows service. This service should be able to monitor and restart the programs. At the moment i have the problem if the control program crashes, i can not start all the instances of the service program, because i can not detect which instance is running and which is not running.

I tried using the System.Diagnostics.Process API and also the WMI API to get some information. But at both variants the Commandline arguments are NOT available.

To start an instance i am using the StartInfo-object of the System.Diagnostics.Process. I read somewhere at stackoverflow that the process information within the StartInfo object is not available to another process, but it should be available by the WMI API - but not in my case ..

Do i have to start the instances another way or exists another way to access the commandline arguments of a running process

A: 

I changed this setup to use System.Management Namespace. Now the processes are listed detected. But i have to process the whole commandline using regular expressions .. that's the only "bad" thing about that

mabu