Prev: Vb.net 2008 - System.data.enumerablerowcollection(of system.data.datarow)convert to string???
Next: VB.NET and Exchange
From: Tom C on 8 Dec 2009 15:25 I have spent hours looking for this and just can't find how to to get the process id of a service running on a given machine. I have a service As System.ServiceProcess.ServiceController in hand but I can't seem to connect the dots to get the correct Process Id. We have multple instances of the same app running for different customers and I need to know at a glance which instance is connected to what Process Id. Anyone know how to do this?
From: Phill W. on 10 Dec 2009 08:37 Tom C wrote: > We have multple instances of the same app running for different > customers and I need to know at a glance which instance is connected > to what Process Id. Can interrogate each "instance"? If so, you could ask /it/ to find out its own Process Id, using System.Diagnostics.Process.GetCurrentProcess().Id Failing that, how does each customer access their own "instance"? Presumably there must be something that directs Customer A to one instance and B to another. HTH, Phill W.
From: Tom C on 10 Dec 2009 09:56 On Dec 10, 7:37 am, "Phill W." <p-.-a-.-w-a-r...@-o-p-e-n-.-a-c-.-u-k> wrote: > Tom C wrote: > > We have multple instances of the same app running for different > > customers and I need to know at a glance which instance is connected > > to what Process Id. > > Can interrogate each "instance"? > > If so, you could ask /it/ to find out its own Process Id, using > > System.Diagnostics.Process.GetCurrentProcess().Id > > Failing that, how does each customer access their own "instance"? > Presumably there must be something that directs Customer A to one > instance and B to another. > > HTH, > Phill W. We know what they are in our management console by the port that they are using and a friendly name but this information is not available to me when trying to attach to a service with visual studio or when looking at task manager; the port is not available; only the process name and pid. So I have the port and friendly name in my management console and I want to also display the pid then I can cross reference it there and know which of the n instance to attach my debugger to. Now if I knew how to query the instance, I would have this data right? That is the question. All that I have in hand is a dim service As System.ServiceProcess.ServiceController. What I need is the code to get to the running process pid from there.
From: Nobody on 10 Dec 2009 12:36 "Tom C" <tom_claffy(a)asdsoftware.com> wrote in message news:55f5285d-8f6a-47e8-9465-b031ccd3e3aa(a)g26g2000yqe.googlegroups.com... >I have spent hours looking for this and just can't find how to to get > the process id of a service running on a given machine. I have a > service As System.ServiceProcess.ServiceController in hand but I can't > seem to connect the dots to get the correct Process Id. We have > multple instances of the same app running for different customers and > I need to know at a glance which instance is connected to what Process > Id. Anyone know how to do this? See QueryServiceStatusEx() or EnumServicesStatusEx() API functions. One of the things they return is dwProcessId. I am not sure if there is an equivalent library function for this. A quick search shows nothing.
From: Tom C on 11 Dec 2009 16:26
On Dec 10, 11:36 am, "Nobody" <nob...(a)nobody.com> wrote: > "Tom C" <tom_cla...(a)asdsoftware.com> wrote in message > > news:55f5285d-8f6a-47e8-9465-b031ccd3e3aa(a)g26g2000yqe.googlegroups.com... > > >I have spent hours looking for this and just can't find how to to get > > the process id of a service running on a given machine. I have a > > service As System.ServiceProcess.ServiceController in hand but I can't > > seem to connect the dots to get the correct Process Id. We have > > multple instances of the same app running for different customers and > > I need to know at a glance which instance is connected to what Process > > Id. Anyone know how to do this? > > See QueryServiceStatusEx() or EnumServicesStatusEx() API functions. One of > the things they return is dwProcessId. I am not sure if there is an > equivalent library function for this. A quick search shows nothing. That was the missing piece. thanks so much. |