473,396 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Background thread in ASP.net

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

Sep 11 '06 #1
4 1571
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

"Avadhoot" <Av******@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.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



Sep 11 '06 #2
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]
"Avadhoot" <Av******@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.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



Sep 11 '06 #3
You can also monitor the file as a CacheDependency.

http://msdn.microsoft.com/msdnmag/is...7/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:
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
Sep 11 '06 #4
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/

---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/

Avadhoot wrote:
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
Sep 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ahsan | last post by:
I have created some background threads so that when the application aborts all the threads should be automatically aborted. But the problem is that when I make a thread background thread I am...
0
by: Gomaw Beoyr | last post by:
Hello The book "C# Black Book" chapter about Threads says that a "background thread" cannot communicate directly with a visual element, e.g. a label, and thus has to use the BeginInvoke method,...
0
by: JC Voon | last post by:
Hi All: I'm new in Threading and Web Services, can someone please verify my code, i'm not sure whether this is the correct way, althought it is partially work, but some time it will raise...
1
by: Flack | last post by:
Hey guys, Here is the scenario: I have the main form open and a background thread is running. The background thread sometimes needs access to the main forms graphics object and gets it by...
1
by: JEB | last post by:
I know that with Web Services, you should be doing everything in a stateless environment. However, I have three methods out of over 100 that need state. I have the client cookie container,...
33
by: bonk | last post by:
I have an application that needs to perform some background work, i.e. Logging, wich must not block the main thread. How would I basically design such a scenario? It is obvious that I should do...
7
by: John J. Hughes II | last post by:
I have a DataGridView with a TextBoxColumn. I setting the data source to a List<stringvalue in a static class. The list is filled from a background thread. So far all is fine and it works...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
4
by: Claire | last post by:
Hi, I'm writing an internal mail system module for my project. There may be several thousand 'users' on site, and I need the whole list for filtering, so I decided to load up the users in the main...
4
by: Marina Levit | last post by:
I am trying to do some processing on a background thread while keeping the UI painting. However, this is a generic server side call routine - and it needs to block until the server side call...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.