473,387 Members | 3,801 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,387 software developers and data experts.

Executing tasks at regular intervals on my ASP.NET 2.0 application

Hi.

I have a web application that needs to run tasks at regular intervals. E.g.
it must send out emails every night to people who subscribe to that service.

I have come up with one solution, to add a System.Timers.Timer component to
my global.asax file and initialize it in Application_Load. But that would
require that my application never shuts down.

Another alternative is to create a windows service to administer the
handling of daily tasks, but that certainly has its drawbacks as well, e.g.
all configuraiton must be maintained both at web application and at the
windows service.

Is using a timer component my best option, or is there a better option?

Thanks in advance
Peter Strĝiman
Nov 19 '05 #1
3 2149
Peter,

You can simply use the Windows Scheduled Task, look in Accessories ->
System Tools.

You can write a simple console application that emails the subscribes
and then set this up as a scheduled task. Very easy to maintain and
control.

Tony

Peter Strĝiman wrote:
Hi.

I have a web application that needs to run tasks at regular intervals. E.g.
it must send out emails every night to people who subscribe to that service.

I have come up with one solution, to add a System.Timers.Timer component to
my global.asax file and initialize it in Application_Load. But that would
require that my application never shuts down.

Another alternative is to create a windows service to administer the
handling of daily tasks, but that certainly has its drawbacks as well, e.g.
all configuraiton must be maintained both at web application and at the
windows service.

Is using a timer component my best option, or is there a better option?

Thanks in advance
Peter Strĝiman


Nov 19 '05 #2
Thanks for Tony's suggestions.

Hi Peter,

As Tony mentioned, we can use a external application to constantly do the
schedule task or using the windows's system schedule task feature. If you
perfer put the work in your asp.net application, I think we only have the
following options:
1. Using a Global Timer as you've mentioned.

2.create a background thread and put the task code in the backgroun
thread's worker function.

However, both of them rely on the asp.net application being alive(not shut
down). As for this, I'm not sure what's the OS and IIS version of your web
server? If you're using IIS6 on win2k3 server , there is an option in the
IIS's snap-in for applciation pool setting, it named: "shut down worker
process after being idle for xxxxx(time)", we can uncheck it so as to
prevent the w3wp worker process from being shutdown after idle for long
time.

Hope helps.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: qu*******@resolutionsnet.co.uk
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: Re: Executing tasks at regular intervals on my ASP.NET 2.0
application
| Date: 29 Jul 2005 05:32:11 -0700
| Organization: http://groups.google.com
| Lines: 35
| Message-ID: <11*********************@f14g2000cwb.googlegroups. com>
| References: <OX**************@TK2MSFTNGP12.phx.gbl>
| NNTP-Posting-Host: 195.153.122.67
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| Content-Transfer-Encoding: quoted-printable
| X-Trace: posting.google.com 1122640336 16472 127.0.0.1 (29 Jul 2005
12:32:16 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Fri, 29 Jul 2005 12:32:16 +0000 (UTC)
| In-Reply-To: <OX**************@TK2MSFTNGP12.phx.gbl>
| User-Agent: G2/0.2
| Complaints-To: gr**********@google.com
| Injection-Info: f14g2000cwb.googlegroups.com; posting-host=195.153.122.67;
| posting-account=icWCZgwAAACc4ywDW_hR4FjFbmwPzTy8
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!news.glorb.com!postnews.google.com!f14g2000c wb.googlegroups.com!not-fo
r-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:115132
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Peter,
| You can simply use the Windows Scheduled Task, look in Accessories ->
| System Tools.
| You can write a simple console application that emails the subscribes
| and then set this up as a scheduled task. Very easy to maintain and
| control.
| Tony
| Peter Strĝiman wrote:
| > Hi.
| >
| > I have a web application that needs to run tasks at regular intervals.
E.g.
| > it must send out emails every night to people who subscribe to that
service.
| >
| > I have come up with one solution, to add a System.Timers.Timer
component to
| > my global.asax file and initialize it in Application_Load. But that
would
| > require that my application never shuts down.
| >
| > Another alternative is to create a windows service to administer the
| > handling of daily tasks, but that certainly has its drawbacks as well,
e.g.
| > all configuraiton must be maintained both at web application and at the
| > windows service.
| >
| > Is using a timer component my best option, or is there a better option?
| >
| > Thanks in advance
| > Peter Strĝiman
|

Nov 19 '05 #3
Hi Peter,

Have you had a chance to read my last reply or have you got any further
ideas on this issue? If there're anything else we can help, please feel
free to post here. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| X-Tomcat-ID: 31905339
| References: <OX**************@TK2MSFTNGP12.phx.gbl>
<11*********************@f14g2000cwb.googlegroups. com>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 01 Aug 2005 02:02:05 GMT
| Subject: Re: Executing tasks at regular intervals on my ASP.NET 2.0
application
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <lq**************@TK2MSFTNGXA01.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 89
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:115382
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Thanks for Tony's suggestions.
|
| Hi Peter,
|
| As Tony mentioned, we can use a external application to constantly do the
| schedule task or using the windows's system schedule task feature. If
you
| perfer put the work in your asp.net application, I think we only have the
| following options:
| 1. Using a Global Timer as you've mentioned.
|
| 2.create a background thread and put the task code in the backgroun
| thread's worker function.
|
| However, both of them rely on the asp.net application being alive(not
shut
| down). As for this, I'm not sure what's the OS and IIS version of your
web
| server? If you're using IIS6 on win2k3 server , there is an option in
the
| IIS's snap-in for applciation pool setting, it named: "shut down worker
| process after being idle for xxxxx(time)", we can uncheck it so as to
| prevent the w3wp worker process from being shutdown after idle for long
| time.
|
| Hope helps.
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
| --------------------
| | From: qu*******@resolutionsnet.co.uk
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | Subject: Re: Executing tasks at regular intervals on my ASP.NET 2.0
| application
| | Date: 29 Jul 2005 05:32:11 -0700
| | Organization: http://groups.google.com
| | Lines: 35
| | Message-ID: <11*********************@f14g2000cwb.googlegroups. com>
| | References: <OX**************@TK2MSFTNGP12.phx.gbl>
| | NNTP-Posting-Host: 195.153.122.67
| | Mime-Version: 1.0
| | Content-Type: text/plain; charset="iso-8859-1"
| | Content-Transfer-Encoding: quoted-printable
| | X-Trace: posting.google.com 1122640336 16472 127.0.0.1 (29 Jul 2005
| 12:32:16 GMT)
| | X-Complaints-To: gr**********@google.com
| | NNTP-Posting-Date: Fri, 29 Jul 2005 12:32:16 +0000 (UTC)
| | In-Reply-To: <OX**************@TK2MSFTNGP12.phx.gbl>
| | User-Agent: G2/0.2
| | Complaints-To: gr**********@google.com
| | Injection-Info: f14g2000cwb.googlegroups.com;
posting-host=195.153.122.67;
| | posting-account=icWCZgwAAACc4ywDW_hR4FjFbmwPzTy8
| | Path:
|
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
|
ne.de!news.glorb.com!postnews.google.com!f14g2000c wb.googlegroups.com!not-fo
| r-mail
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.aspnet:115132
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | Peter,
| | You can simply use the Windows Scheduled Task, look in Accessories ->
| | System Tools.
| | You can write a simple console application that emails the subscribes
| | and then set this up as a scheduled task. Very easy to maintain and
| | control.
| | Tony
| | Peter Strĝiman wrote:
| | > Hi.
| | >
| | > I have a web application that needs to run tasks at regular
intervals.
| E.g.
| | > it must send out emails every night to people who subscribe to that
| service.
| | >
| | > I have come up with one solution, to add a System.Timers.Timer
| component to
| | > my global.asax file and initialize it in Application_Load. But that
| would
| | > require that my application never shuts down.
| | >
| | > Another alternative is to create a windows service to administer the
| | > handling of daily tasks, but that certainly has its drawbacks as
well,
| e.g.
| | > all configuraiton must be maintained both at web application and at
the
| | > windows service.
| | >
| | > Is using a timer component my best option, or is there a better
option?
| | >
| | > Thanks in advance
| | > Peter Strĝiman
| |
|
|

Nov 19 '05 #4

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

Similar topics

13
by: BK | last post by:
Can someone point me to a code sample that illustrates executing long running tasks (asynchronous) from a web application in ASP.NET? I assume that Web Services might come into play at some point,...
8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the function executes as normal. At first I thought it...
0
by: gomzi | last post by:
i have a php script which i need to execute at regular intervals in order to make some changes in my mysql db. my website is hosted on a shared windows hosting account. so is it possible to schedule...
1
by: jaffarkazi | last post by:
Hi I have a page that is going to send a number of emails that will be fetched from the database. This is on a hosted server, so I don't have any background automatic way of sending mail. (If...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.