473,748 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.T imer component to
my global.asax file and initialize it in Application_Loa d. 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 2175
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.T imer component to
my global.asax file and initialize it in Application_Loa d. 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*******@resol utionsnet.co.uk
| Newsgroups: microsoft.publi c.dotnet.framew ork.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************ *********@f14g2 000cwb.googlegr oups.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**********@go ogle.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**********@go ogle.com
| Injection-Info: f14g2000cwb.goo glegroups.com; posting-host=195.153.12 2.67;
| posting-account=icWCZgw AAACc4ywDW_hR4F jFbmwPzTy8
| Path:
TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!ne wsfeed00.sul.t-online.de!t-onli
ne.de!news.glor b.com!postnews. google.com!f14g 2000cwb.googleg roups.com!not-fo
r-mail
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1151 32
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.T imer
component to
| > my global.asax file and initialize it in Application_Loa d. 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************ *********@f14g2 000cwb.googlegr oups.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.publi c.dotnet.framew ork.aspnet
| Message-ID: <lq************ **@TK2MSFTNGXA0 1.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Lines: 89
| Path: TK2MSFTNGXA01.p hx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1153 82
| 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*******@resol utionsnet.co.uk
| | Newsgroups: microsoft.publi c.dotnet.framew ork.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************ *********@f14g2 000cwb.googlegr oups.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**********@go ogle.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**********@go ogle.com
| | Injection-Info: f14g2000cwb.goo glegroups.com;
posting-host=195.153.12 2.67;
| | posting-account=icWCZgw AAACc4ywDW_hR4F jFbmwPzTy8
| | Path:
|
TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!ne wsfeed00.sul.t-online.de!t-onli
|
ne.de!news.glor b.com!postnews. google.com!f14g 2000cwb.googleg roups.com!not-fo
| r-mail
| | Xref: TK2MSFTNGXA01.p hx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:1151 32
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.T imer
| component to
| | > my global.asax file and initialize it in Application_Loa d. 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
2854
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, but I'm not sure how to get started. For example, I have an application that, upon a user initiating through a button or link click, will go out and generate a bunch of files (this could take several minutes). This will happen in batches, so I...
8
2464
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 was the entire function failing, but I tested with alerts and found that it was only the 'window.open' that fails to execute. The function is being called by a link, and I suspected some problem with the body alink/vlink but after cutting that out...
0
1208
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 the script?
1
1713
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 anyone can make a suggestion for this, that would be good too). There may be 2 mails or 100 mails. I'm not particularly interested that the page will timeout or not. The tasks will basically be: 1. Pick up the emails from the database.
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9552
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9326
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.