ASP.NET and background threads

  • Thread starter Thread starter Paul Hatcher
  • Start date Start date
P

Paul Hatcher

I have an ASP.NET application that uses a background threads to perform a
long-running process. What I'm not sure is how to track and communicate with
the thread.

The site is divided up into sections, each of which could have it's own
background process. Given that any user should be able to inquire against
the current status of a process thread, I don't know how to keep a reference
to it unless I just put it into Global.asax, which seems a bit tacky.

On a similar problem, I can't see how to retreive status information from
the background process; I can give it an interface etc, but given that the
page that needs the info is nothing to do with the page that initiated the
action I can't see where to put the hooks.

Regards

Paul
 
Ideally you don't want to do a long running task inside the asp.net process
using a background thread, why? because it will compete with the both iis &
asp.net for system resources and therefore give you a less scalable and less
responsive system. Rather you should thinking about moving the long running
task out-of-process from the asp.net process so that it is executed
asynchronously, message queues (MQ) are very suitable for this solution. As
for status information that will depend on how you implement the solution
but you will probably end up writing status information to a data repository
(database) so that it can be queried by any interested party.

HTH

Ollie Riches
 
You're right - that would probably solve one of my major problems at the
moment, the ASP.NET process being recycled and therefore terminating the
background process.

Ok, time to read-up on invoking MSMQ from .NET :-)

Thanks

Paul
 
Back
Top