473,624 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Timers and Services

Hello,

I've written a windows service and so far what it does is browse to a
shared directory on an extranet. Check to see if any files exist in
this folder, if any do, the service downloads, processes and then
uploads a response file back up to a different shared folder.
My Question:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.

Has anyone done something like this and if so how. I have been looking
around but can't seem to find any info on anything like this.

Thanks in Advance.

Nov 17 '05 #1
8 1521
Hi,

Why don't use a scheduled job instead?
Anyway, the answer shoudl be yes, I have a similar deployment, I do not use
itmers, I use FileSystemWatch er instead and it work fine, I create and
initialize the watcher in the onload and the process keep waiting until the
event is received.
The above solution is something you should consider, it's safer, in any
case do not hardcode the times, it could change later on and you would have
to redeploy your solution
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<Pa*********@gm ail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hello,

I've written a windows service and so far what it does is browse to a
shared directory on an extranet. Check to see if any files exist in
this folder, if any do, the service downloads, processes and then
uploads a response file back up to a different shared folder.
My Question:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.

Has anyone done something like this and if so how. I have been looking
around but can't seem to find any info on anything like this.

Thanks in Advance.

Nov 17 '05 #2
Hi,

Why don't use a scheduled job instead?
Anyway, the answer shoudl be yes, I have a similar deployment, I do not use
itmers, I use FileSystemWatch er instead and it work fine, I create and
initialize the watcher in the onload and the process keep waiting until the
event is received.
The above solution is something you should consider, it's safer, in any
case do not hardcode the times, it could change later on and you would have
to redeploy your solution
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<Pa*********@gm ail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hello,

I've written a windows service and so far what it does is browse to a
shared directory on an extranet. Check to see if any files exist in
this folder, if any do, the service downloads, processes and then
uploads a response file back up to a different shared folder.
My Question:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.

Has anyone done something like this and if so how. I have been looking
around but can't seem to find any info on anything like this.

Thanks in Advance.

Nov 17 '05 #3
The windows task sheduler has been disabled and I'm not allowed to use
it.
I can't use the FileSystemWatch er as the folders exist on an extranet
and I can't set up any webfolders on my server.

Sorry I forgot to mention that in the previous post

regards
Paul

Nov 17 '05 #4
The windows task sheduler has been disabled and I'm not allowed to use
it.
I can't use the FileSystemWatch er as the folders exist on an extranet
and I can't set up any webfolders on my server.

Sorry I forgot to mention that in the previous post

regards
Paul

Nov 17 '05 #5
On 31 Aug 2005 06:28:06 -0700, Pa*********@gma il.com wrote:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.


Set your Windows service to start automatically, this way it will be always
running. Then use a System.Threadin g.Timer for you sheduled jobs. One of
its overloaded constructors takes 2 TimeSpan as parameters. The first one
is the time before the first callback invoke (set it to the time remaining
before 4am) and the second one is the time between 2 callback invokes (set
it to 20 minutes). When the callback method is invoked, check the time: if
it's 6am or later, Dispose your timer to stop it and recreate one for the
next day; if it's before 6am, do whatever you have to do.

Be carefull not to use using a System.Timers.T imer as it seems to be buggy
when used whithin a Windows Service (see
http://support.microsoft.com/default...b;en-us;842793)
Nov 17 '05 #6
On 31 Aug 2005 06:28:06 -0700, Pa*********@gma il.com wrote:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.


Set your Windows service to start automatically, this way it will be always
running. Then use a System.Threadin g.Timer for you sheduled jobs. One of
its overloaded constructors takes 2 TimeSpan as parameters. The first one
is the time before the first callback invoke (set it to the time remaining
before 4am) and the second one is the time between 2 callback invokes (set
it to 20 minutes). When the callback method is invoked, check the time: if
it's 6am or later, Dispose your timer to stop it and recreate one for the
next day; if it's before 6am, do whatever you have to do.

Be carefull not to use using a System.Timers.T imer as it seems to be buggy
when used whithin a Windows Service (see
http://support.microsoft.com/default...b;en-us;842793)
Nov 17 '05 #7
Thanks Mehdi....

You've given me a great starting point....I'

I'll give it a bash and see how I progress!

Nov 17 '05 #8
Thanks Mehdi....

You've given me a great starting point....I'

I'll give it a bash and see how I progress!

Nov 17 '05 #9

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

Similar topics

0
1761
by: Dmitry Demchuk | last post by:
Hi everybody. Recently I ran into situation with System.Threading.Timer in my ASP.NET application. I reinstalled Windows on one of my servers and got timers stop firing events after while, they just stop functioning one-by-one. Here is detailed explanation. I run application on 2 dedicated Win 2003 servers. Server A serves about 1000 active simultaneous users (150-200 aspx page requests per second), Sever B serves about 400 users (80-100...
1
1679
by: Jason | last post by:
Hi all just a quick question. I have a windows service with a "Catalogue" class. I would like to know: if i put two "ServiceTimer" objects in my service 1. Do they run in separate threads (i have never threaded before, so excuse my ignorance) 2. If i have instances of the catalogue class in both those timers, will there be an error? for example, if Timer1 loops every 10 mins, and Timer2 loops every 3
3
2191
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My issue is simply getting timers to work. I have a DatabaseManager.DataManagerFacade which contains a timer. Every 6 seconds it updates stock data using an online webservice. I wrote have 2 possible startup projects to make the service work. One...
9
7861
by: Mark Rae | last post by:
Hi, I've seen several articles about using System Timers in ASP.NET solutions, specifically setting them up in Global.asax' Application_OnStart event. I'm thinking about the scenario where I might need to carry out some back-end processing without pausing the individual users' Session while that process runs. E.g. I might provide the ability for a user to upload a text file of job
1
2387
by: james.e.coleman | last post by:
Hello, System.Timers.Timer/System.Threading.Timer do not fire on my development server, yet they work perfectly on the production server. I would appreciate any help on what the cause of this could be. I am convinced it is not the code since the code works on another machine. Thanks,
1
1119
by: jeff | last post by:
Greetings; Newbie here, please forgive my ignorance of the vb.net threading model. I am developing a windows service which is driven by a variable number of timers. All timers use the same event handler, and each invocation sends a command to another service. What are the threading considerations given this scenario?
2
1333
by: jeff | last post by:
Greetings; Newbie here, please forgive my ignorance of the vb.net threading model. I am developing a windows service which is driven by a variable number of timers. All timers invoke the same event handler, and each invocation sends a command to another service. What are the threading considerations given this scenario?
2
2209
by: cntams | last post by:
All, I have a Windows Service and it has one System.Timers.Timer that fires every 500 milliseconds. Now I have noticed that there's a bug in System.Timers.Timer when it's being used combined with Windows Service. That is, the Timer won't fire again once it's stopped (Timer.Stop() or Timer.Enabled = False) (http://support.microsoft.com/kb/842793/en-us). Instead of using Threading.Timer, can I just have the code to run inside the...
5
12210
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the event handlers may take longer than the interval for either of the timers, so it's possible for multiple events to fire "simultaneously" and for events to queue up. I'm attempting to get the timers to sync on some reference type object, or use...
0
8242
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
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
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,...
0
8488
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2611
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
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
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.