473,804 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tracking down threads created within a ASP.NET app

I am using the System.Diagnost ics.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 1546
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.Diagnost ics.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.Diagnost ics.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
7969
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) } document.onmousemove=mousePos; Seems to do fine on many browsers.
3
1964
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 for is this... tblCommunications trxCommunicationThreads ----------------- ----------------------- CommunicationID (PK) CommID1 (FK1)(PK) ContactID (FK from contact table) CommID2...
34
10819
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; public class A {
11
1460
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 accessed in order to retrieve information. From within the “Application_Start” (Global.asax), I create as many threads as servers we have available. The idea is that each thread will query each server and update a flag in the public array. When a...
6
1998
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 efficiency I'm looking to add). But when I declare, e.g., Public objSession As MAPI.Session I can't access objSession from a worker thread. Thanks in advance for any advice.
16
2891
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 process, and I can't figure out what's causing them. I have a ton of select queries (but none for update), and then a single query to insert into a table. Nothing selects from that table. So where could the deadlock be? pg_stat_activity has a column...
4
1572
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 then asynchronously retrieve and resize the full image previews and update the PictureBox's Images when the new images are ready. The way I have it set up now, the method which generates the filetype icons creates and starts the new worker Threads....
167
8375
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 object should run in its own thread, it should implement this mix-in class. Does this sound like plausible design decision? I'm surprised that C++ doesn't have such functionality, say in its STL. This absence of a thread/object relationship in...
23
4302
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 different modules, and have a dedicated thread for the each module. Modules exchanged info through a in-memory message queue. In my opinion, such a model means very complicated asynchronous
0
10571
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10326
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
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, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.