473,425 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Tracking down threads created within a ASP.NET app

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.

Nov 19 '05 #1
3 1525
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 <m@m.com> 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 dont 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.


Nov 19 '05 #2
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 <m@m.com> 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.


Nov 19 '05 #3
Hi mareal:

Are you on IIS 6.0?
It sounds like your process is recycling.
http://www.microsoft.com/resources/d...ewpconfig.mspx

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

On Fri, 4 Mar 2005 09:55:06 -0800, mareal <m@m.com> 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:


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
3
by: Bryan Christopher | last post by:
Hello All! I have a rather abstract question for some genius out there to answer. I want to integrate communication tracking, for customer relations, into an existing Access DB. What I was going...
34
by: Kovan Akrei | last post by:
Hi, I would like to know how to reuse an object of a thread (if it is possible) in Csharp? I have the following program: using System; using System.Threading; using System.Collections; ...
11
by: mareal | last post by:
I am trying to write a basic load balancer (in our web service) solution. The purpose of this load balancer is to keep an array updated with server status. We have several servers that can be...
6
by: Gary Lee | last post by:
In VB.NET using CDO, I'd like to allow multiple threads to share a single MAPI.Session object. If I declare and instantiate sessions within each thread, I'm OK (although this negates the...
16
by: Ben | last post by:
I'm doing a bunch of data mining against a postgres database and have run into an interesting problem with deadlocks. The problem is, postgres is detecting them and then wacking the offending...
4
by: Lunchtimemama | last post by:
I have a UI with a gallery of thumbnail image previews. The PictureBoxes are created and their Images are generated by a method which quickly retrieves the icon for the filetype. Worker threads...
167
by: darren | last post by:
Hi I have to write a multi-threaded program. I decided to take an OO approach to it. I had the idea to wrap up all of the thread functions in a mix-in class called Threadable. Then when an...
23
by: =?GB2312?B?0rvK18qr?= | last post by:
Hi all, Recently I had a new coworker. There is some dispute between us. The last company he worked for has a special networking programming model. They split the business logic into...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.