Tracking down threads created within a ASP.NET app

Discussion in 'ASP .Net' started by =?Utf-8?B?bWFyZWFs?=, Mar 4, 2005.

  1. I am using the System.Diagnostics.Process class in order to loop thru all the
    processes running. Within that loop I am looking for the process name
    “aspnet_wp†in order to get the process ID. Once I find it, I use the process
    ID to find all the threads running under that process. This works fine so
    far. What I would like to do is to be able to detect/find the threads that my
    ASP.NET app. created.

    I have tried giving the threads I created a name (t1.Name = "SampleThread"),
    but I don’t find a way to search for these names.

    My question is: How can I find the threads I create from within my ASP.NET
    app?

    Thanks in advance.
     
    =?Utf-8?B?bWFyZWFs?=, Mar 4, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?bWFyZWFs?=

    Scott Allen Guest

    Hi mareal:

    Can you keep a reference around when you create the thread?

    The problem with Process.Threads is that it returns a collection of
    operating system threads. A thread in .NET is a logical thread and
    doesn't have to have a 1:1 mapping with operating system threads
    (although in 1.x they do, MS didn't want to tie themselves to this
    implementation).

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Fri, 4 Mar 2005 07:33:07 -0800, mareal <> wrote:

    >I am using the System.Diagnostics.Process class in order to loop thru all the
    >processes running. Within that loop I am looking for the process name
    >“aspnet_wp” in order to get the process ID. Once I find it, I use the process
    >ID to find all the threads running under that process. This works fine so
    >far. What I would like to do is to be able to detect/find the threads that my
    >ASP.NET app. created.
    >
    >I have tried giving the threads I created a name (t1.Name = "SampleThread"),
    >but I don’t find a way to search for these names.
    >
    >My question is: How can I find the threads I create from within my ASP.NET
    >app?
    >
    >Thanks in advance.
     
    Scott Allen, Mar 4, 2005
    #2
    1. Advertising

  3. Thanks Scott. If keeping a reference is the only way to check their status, I
    will do that. Something else, I am noticing that the threads I create die
    after 20 minutes or so of inactivity. I have added Try-Catch block in the
    thread itself hoping that when the thread dies, an exception will be thrown.
    But I am not seeing any of that. How can I recover from a dying thread?

    "Scott Allen" wrote:

    > Hi mareal:
    >
    > Can you keep a reference around when you create the thread?
    >
    > The problem with Process.Threads is that it returns a collection of
    > operating system threads. A thread in .NET is a logical thread and
    > doesn't have to have a 1:1 mapping with operating system threads
    > (although in 1.x they do, MS didn't want to tie themselves to this
    > implementation).
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > On Fri, 4 Mar 2005 07:33:07 -0800, mareal <> wrote:
    >
    > >I am using the System.Diagnostics.Process class in order to loop thru all the
    > >processes running. Within that loop I am looking for the process name
    > >“aspnet_wp†in order to get the process ID. Once I find it, I use the process
    > >ID to find all the threads running under that process. This works fine so
    > >far. What I would like to do is to be able to detect/find the threads that my
    > >ASP.NET app. created.
    > >
    > >I have tried giving the threads I created a name (t1.Name = "SampleThread"),
    > >but I don’t find a way to search for these names.
    > >
    > >My question is: How can I find the threads I create from within my ASP.NET
    > >app?
    > >
    > >Thanks in advance.

    >
    >
     
    =?Utf-8?B?bWFyZWFs?=, Mar 4, 2005
    #3
  4. =?Utf-8?B?bWFyZWFs?=

    Scott Allen Guest

    Hi mareal:

    Are you on IIS 6.0?
    It sounds like your process is recycling.
    http://www.microsoft.com/resources/documentation/iis/6/all/proddocs/en-us/ca_recyclewpconfig.mspx

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Fri, 4 Mar 2005 09:55:06 -0800, mareal <> wrote:

    >Thanks Scott. If keeping a reference is the only way to check their status, I
    >will do that. Something else, I am noticing that the threads I create die
    >after 20 minutes or so of inactivity. I have added Try-Catch block in the
    >thread itself hoping that when the thread dies, an exception will be thrown.
    >But I am not seeing any of that. How can I recover from a dying thread?
    >
    >"Scott Allen" wrote:
    >
     
    Scott Allen, Mar 4, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    653
    Jonathan N. Little
    Feb 16, 2006
  2. fooooo
    Replies:
    5
    Views:
    954
    Paul Rubin
    May 3, 2005
  3. Jp Calderone
    Replies:
    1
    Views:
    1,376
    Paul Rubin
    May 24, 2005
  4. msimmons
    Replies:
    0
    Views:
    543
    msimmons
    Jul 16, 2009
  5. Headless Rider

    Control asp.net app from other asp.net app

    Headless Rider, Aug 18, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    128
    Headless Rider
    Aug 18, 2003
Loading...

Share This Page