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

P

Peter Strøiman

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
 
Q

questions

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
 
S

Steven Cheng[MSFT]

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: (e-mail address removed)
| 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: <[email protected]>
| References: <[email protected]>
| 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: (e-mail address removed)
| NNTP-Posting-Date: Fri, 29 Jul 2005 12:32:16 +0000 (UTC)
| In-Reply-To: <[email protected]>
| User-Agent: G2/0.2
| Complaints-To: (e-mail address removed)
| Injection-Info: f14g2000cwb.googlegroups.com; posting-host=195.153.122.67;
| posting-account=icWCZgwAAACc4ywDW_hR4FjFbmwPzTy8
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!news.glorb.com!postnews.google.com!f14g2000cwb.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
|
 
S

Steven Cheng[MSFT]

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: <[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (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: <[email protected]>
| 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: (e-mail address removed)
| | 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: <[email protected]>
| | References: <[email protected]>
| | 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: (e-mail address removed)
| | NNTP-Posting-Date: Fri, 29 Jul 2005 12:32:16 +0000 (UTC)
| | In-Reply-To: <[email protected]>
| | User-Agent: G2/0.2
| | Complaints-To: (e-mail address removed)
| | Injection-Info: f14g2000cwb.googlegroups.com;
posting-host=195.153.122.67;
| | posting-account=icWCZgwAAACc4ywDW_hR4FjFbmwPzTy8
| | Path:
|
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
|
ne.de!news.glorb.com!postnews.google.com!f14g2000cwb.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
| |
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top