Home All Groups Group Topic Archive Search About

Background thread in ASP.net

Author
11 Sep 2006 11:22 AM
Avadhoot
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

Author
11 Sep 2006 11:47 AM
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

Show quoteHide quote
"Avadhoot" <Avadh***@discussions.microsoft.com> wrote in message
news:E69FDB30-8FAE-470F-80E3-1C30AAB54C97@microsoft.com...
> 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
>
>
>
>
>
Are all your drivers up to date? click for free checkup

Author
11 Sep 2006 12:25 PM
Brennan Stehling
You can also monitor the file as a CacheDependency.

http://msdn.microsoft.com/msdnmag/issues/04/07/CuttingEdge/

Just load the file as you need it and add it to the cache and monitor
it as a dependency.  You can handle the cache remove callback to reload
the file when it changes.

Brennan Stehling
http://brennan.offwhite.net/blog/

Avadhoot wrote:
Show quoteHide quote
> 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
Author
11 Sep 2006 12:47 PM
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.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Show quoteHide quote
"Avadhoot" <Avadh***@discussions.microsoft.com> wrote in message
news:E69FDB30-8FAE-470F-80E3-1C30AAB54C97@microsoft.com...
> 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
>
>
>
>
>

Bookmark and Share