473,473 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Scheduling within a windows service

Hi all,

Can anyone point me in the direction of how to have a .net developed
service wake up every sof often to perform a task.

I need to make a service that will wake up every 15 mins to check a
database.

Is there some sort of event/notification API in .net that I can use?

I'm guessing this is a fairly typical requirement

Many thanks for your help

Simon
May 18 '06 #1
9 1209
Use a timer
May 18 '06 #2
yes i think timers are the way you want to go. However spend some time
and research them a little. Some are better in certain circumstances
then others. If I remembered which was which I'd tell ya, but it was 2
years ago...

May 18 '06 #3
On 18 May 2006 06:16:31 -0700, "Red2" <sd******@gmail.com> wrote:
yes i think timers are the way you want to go. However spend some time
and research them a little. Some are better in certain circumstances
then others. If I remembered which was which I'd tell ya, but it was 2
years ago...


I couldn't get a timer to work in a service. I put a worker thread in
ran in a loop sleeping for the requisite interval and that worked
fine.

May 18 '06 #4
Imortant:
use System.Timers.Timer
not System.Windows.Forms.Timer
It caught me out

HTH

"Stuart Nathan" <St***********@homecall.co.uk> wrote in message
news:O7**************@TK2MSFTNGP02.phx.gbl...
Use a timer

May 18 '06 #5
On Thu, 18 May 2006 09:25:08 -0400, r norman
<NotMyRealEmail@_comcast.net> wrote:
On 18 May 2006 06:16:31 -0700, "Red2" <sd******@gmail.com> wrote:
yes i think timers are the way you want to go. However spend some time
and research them a little. Some are better in certain circumstances
then others. If I remembered which was which I'd tell ya, but it was 2
years ago...


I couldn't get a timer to work in a service. I put a worker thread in
ran in a loop sleeping for the requisite interval and that worked
fine.

Probably Stuart Irving's comment would have solved my problem.

May 18 '06 #6
Hi Guys,

Thanks for all your comments.

I did think about using timers initially, but I was concerned that they
worked by constantly polling thereby being inefficient.

Is it definately the case that using a timer 24/7 wont be overly
burdensome? I just thought there might be some other way that was more
efficient?

I could quite believe that there isnt - I just really wanted to make
sure before I do anything

Many thanks
Simon
May 18 '06 #7
On Thu, 18 May 2006 16:49:05 +0100, Simon Harvey
<no******@hotmail.com> wrote:
Hi Guys,

Thanks for all your comments.

I did think about using timers initially, but I was concerned that they
worked by constantly polling thereby being inefficient.

Is it definately the case that using a timer 24/7 wont be overly
burdensome? I just thought there might be some other way that was more
efficient?

I could quite believe that there isnt - I just really wanted to make
sure before I do anything

Many thanks
Simon


Neither the timer nor alternative of putting a worker thread into a
sleep loop uses any significant system resources. Neither one uses
CPU time between wake-ups or timeouts. There are two questions. One
is elegance of design and the timer is the proper way to go. The
second is how best to get the job done simply and quickly and my
worker thread did that for me faster than trying to figure out how to
make a timer function properly inside a service.
May 18 '06 #8
Stuart Irving wrote:
Imortant:
use System.Timers.Timer
not System.Windows.Forms.Timer
It caught me out


No, use the System.Threading.Timers. I think these are specifically for
services.
May 18 '06 #9
Timers work just the same in a service or in a desktop application.
They are really simple, as you simply add your coded in the timer.tick or
timer.elapsed event
May 20 '06 #10

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

Similar topics

5
by: Attila | last post by:
Hi. I am looking for a site or some coding ideas to run specific subs or programs at certain times and/or dates. For example, I would like to automate pulling data via ADO(.NET) at 6 am, on...
6
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something...
0
by: steve | last post by:
I've seen questions about scheduling ASP scripts posted in this group many times so hopefully this will be useful information to a few people. I just wanted to let you all know that our script...
3
by: mirek | last post by:
Hello, My ASP.NET application must have additional functionality which isn't typical for ordinary web use. It is: - connecting to the other server using specified protocol (an option to...
2
by: Randall Powell | last post by:
I am in the process of developing a Windows Service which will: (1) monitor multiple network shares; (2) marshal text file transfers into an SQL Server 2000 instance; and (3) provide messaging...
1
by: Majed | last post by:
hi I'm planing to make scheduling app and need your advice on the best way to do that,and how to save the tasks to be executed and retrive their data at the right time. your input will be highly...
9
by: Simon Harvey | last post by:
Hi all, Can anyone point me in the direction of how to have a .net developed service wake up every sof often to perform a task. I need to make a service that will wake up every 15 mins to...
4
by: archana | last post by:
Hi all, I want to develop one windows service in which i want to provide some scheduling facility. What i want is to take start time frm one xml file and then at that specified start time. ...
4
by: Dinsdale | last post by:
I'm looking at adding scheduling features to an application and I wanted to ask the community about any experience with scheduling components, either open source like from code project or from a...
5
by: Jeff | last post by:
Hey ..NET 2.0 I'm working on a winservice created in .NET 2.0. Now I want to do some modications to this winservice. I want this winservice at every start of a new month to start a thread...
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
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,...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.