473,406 Members | 2,847 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,406 software developers and data experts.

Background processing in ASP.NET page

Hi,
I'm working on a web application in ASP.NET 3.5 and need some help with
processing stuff in the background.

The user who visits a web page can make reservations. Each reservation
will result in a notification for the user and an involved company.
Sending the notifications can take some seconds but the user shouldn't
need to wait for the page. So the only way to handle this is AFAIK to do
some background processing that is not connected to the page processing
itself.

In the application I store all notifications that need to be sent in the
database so another process can take them from there and send them.
However I'm unsure how to realize this process. Due to the hosted
environment so there is no chance to deploy a Windows service.

The following solutions seem to be possible:
1. Create a QueueUserWorkItem that handles the process:
ThreadPool.QueueUserWorkItem(new WaitCallback(SendNotifications));

A problem seems to be that under high load the ASP.NET thread pool can
run out of processes.

2. Create a background thread that handles the process:
Thread thread = new Thread(new ThreadStart(SendNotifications));
thread.IsBackground = true;
thread.Start();

3. Create a System.Threading.Timer in global.asax that regularly looks
(like every 5 min) for notifications to be sent and sends them.

Has anyone tips which of these solutions seems to be the best in this
case or maybe there is even another one I haven't thought of?

Thanks,
Hilmar
Jun 27 '08 #1
2 2167
Google for Asynchronous Operations in ASP.NET. This could be the starting
point:

http://www.beansoftware.com/asp.net-...n-pattern.aspx
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Hilmar Bunjes" <ne*******@silveraxe.dewrote in message
news:48**********************@newsspool1.arcor-online.net...
Hi,
I'm working on a web application in ASP.NET 3.5 and need some help with
processing stuff in the background.

The user who visits a web page can make reservations. Each reservation
will result in a notification for the user and an involved company.
Sending the notifications can take some seconds but the user shouldn't
need to wait for the page. So the only way to handle this is AFAIK to do
some background processing that is not connected to the page processing
itself.

In the application I store all notifications that need to be sent in the
database so another process can take them from there and send them.
However I'm unsure how to realize this process. Due to the hosted
environment so there is no chance to deploy a Windows service.

The following solutions seem to be possible:
1. Create a QueueUserWorkItem that handles the process:
ThreadPool.QueueUserWorkItem(new WaitCallback(SendNotifications));

A problem seems to be that under high load the ASP.NET thread pool can run
out of processes.

2. Create a background thread that handles the process:
Thread thread = new Thread(new ThreadStart(SendNotifications));
thread.IsBackground = true;
thread.Start();

3. Create a System.Threading.Timer in global.asax that regularly looks
(like every 5 min) for notifications to be sent and sends them.

Has anyone tips which of these solutions seems to be the best in this case
or maybe there is even another one I haven't thought of?

Thanks,
Hilmar

Jun 27 '08 #2
This article http://www.eggheadcafe.com/articles/20040916.asp may provide
some direction on how to use an HttpModule with a Timer to do polling.
--Peter
"Hilmar Bunjes" <ne*******@silveraxe.dewrote in message
news:48**********************@newsspool1.arcor-online.net...
Hi,
I'm working on a web application in ASP.NET 3.5 and need some help with
processing stuff in the background.

The user who visits a web page can make reservations. Each reservation
will result in a notification for the user and an involved company.
Sending the notifications can take some seconds but the user shouldn't
need to wait for the page. So the only way to handle this is AFAIK to do
some background processing that is not connected to the page processing
itself.

In the application I store all notifications that need to be sent in the
database so another process can take them from there and send them.
However I'm unsure how to realize this process. Due to the hosted
environment so there is no chance to deploy a Windows service.

The following solutions seem to be possible:
1. Create a QueueUserWorkItem that handles the process:
ThreadPool.QueueUserWorkItem(new WaitCallback(SendNotifications));

A problem seems to be that under high load the ASP.NET thread pool can run
out of processes.

2. Create a background thread that handles the process:
Thread thread = new Thread(new ThreadStart(SendNotifications));
thread.IsBackground = true;
thread.Start();

3. Create a System.Threading.Timer in global.asax that regularly looks
(like every 5 min) for notifications to be sent and sends them.

Has anyone tips which of these solutions seems to be the best in this case
or maybe there is even another one I haven't thought of?

Thanks,
Hilmar
Jun 27 '08 #3

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

Similar topics

5
by: Bryan Field-Elliot | last post by:
We're designing a web app in which some operations will take a long time to complete (maybe two minutes). Because it's a high-volume application, we don't want browser connections hanging open for...
1
by: jurot | last post by:
Hi, Can somebody help me,pls? After the button-click on the web-page I execute another thread private void btnExecutePlugin_Click(object sender, System.EventArgs e) { MyThread pt = new...
2
by: Steve Franks | last post by:
I am familiar with the fact that you have to use runat=server and links staring with "~/" to ensure proper mapping of paths to relative URLs when using master pages. However this does not seem to...
3
by: Viken Karaguesian | last post by:
Hello all, I need somehelp with background tiling. I have a sneaking suspicion that what I want to do is not possible, but I'll ask anyway. :>) First some background: Here's the site in...
0
by: Kalpesh | last post by:
Hi All, I am using .net crystal reports to develop the reports. The version of crystal report assemblies is 10.2.3600.0. When i run the reports i got following error. #region Retry Report...
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...
2
by: patrice.pare | last post by:
Hello, Here is a summary of my Dev Environment: I use Visual Studio 2005 Team Suite SP1 with Crystal Report XI SP1 on a Windows XP SP2 development workstation. I also use SQL Server 2000 SP4. ...
4
by: devphylosoff | last post by:
hi folks I am looking for a tool (script, plugin, code, ...) which can generate background image for webpage look at background on http://vtorrent.info/ page or on the Vista webpage. I want...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.