By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,610 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,610 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.