|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Background thread in ASP.netI 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 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 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 > > > > > 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 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 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. -- Show quoteEliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET] "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 > > > > > |
|||||||||||||||||||||||