Background thread in ASP.net

G

Guest

Hi,

I need to create a back ground thread in ASP.Net, but I want it be created
only once.

Here, let me explain.

I have a web application project where the user uploads an excel file. On ce
the file is uploaded and stored on the server, I need to create a thread
which runs in the background and when notified, should open the excel file
and read it's contents.

But, I do not want to create a new thread whenever user requests for the
page and uploads a new excel file. I want it to be created only once and
running in the background, and called when required.

Can any one throw some light on this problem.

Thank you.

Avadhoot K
 
G

Grant Merwitz

Try look at the FileSystemWatcher.

This will run as a windows form/console and watch a folder.
The second a file is dropped into that folder, it can trigger a process.

Hope that helps
 
E

Eliyahu Goldin

Avadhoot,

I think a Windows service fits better into your scenario. You can notify
the service from your web application in a number of ways, the easiest being
just creating a special zero-length file.
 
J

Jason Kester

This sounds like the job for a Service. You don't give any specific
reason why this thing needs to be running inside the IIS process, so
I'll assume that this is just a case of a guy with a hamer seeing
everything as a nail.

Services are easy to build and deploy, and are really good at watching
filesystems and databases, waiting for things to change so that they
can act. This counds like exactly what you want. As somebody else
mentioned, there's even a FileSystemWatcher class available that will
take you most of the way.

Good luck!

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top