Can we schedule the time of start of Window service in c#.

4 views
Skip to first unread message

VB

unread,
Dec 28, 2009, 1:28:52 AM12/28/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi,
I have a window service and I am installing and starting it manually.
My service is deleting some folders on some defined criteria. My
service is working fine and deleting the folders but here I want to
schedule a timer and on a specific time interval service will run. How
I can do this?

Regards,
VB

Raghupathi Kamuni

unread,
Dec 28, 2009, 2:21:35 AM12/28/09
to dotnetde...@googlegroups.com
You can use a Timer object (System.Timers),
1) OnStart Event of the service enable the time, set the time interval and handle the ElapsedEventHandler.
2) In the Elapsed event handler function call your function which deletes the folders.
 
Check here for more details
http://www.aspfree.com/c/a/C-Sharp/Timer-Objects-in-Windows-Services-with-C-sharp-dot-NET/

VB

unread,
Dec 28, 2009, 5:21:45 AM12/28/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting

Thanks,
Well I done it... :)

Regards,
VB

On Dec 28, 12:21 pm, Raghupathi Kamuni <raghukam...@gmail.com> wrote:
> You can use a Timer object (System.Timers),
> 1) OnStart Event of the service enable the time, set the time interval and
> handle the ElapsedEventHandler.
> 2) In the Elapsed event handler function call your function which deletes
> the folders.
>

> Check here for more detailshttp://www.aspfree.com/c/a/C-Sharp/Timer-Objects-in-Windows-Services-...


>
>
>
> On Mon, Dec 28, 2009 at 11:58 AM, VB <vipul....@gmail.com> wrote:
> > Hi,
> > I have a window service and I am installing and starting it manually.
> > My service is deleting some folders on some defined criteria. My
> > service is working fine and deleting the folders but here I want to
> > schedule a timer and on a specific time interval service will run. How
> > I can do this?
>
> > Regards,

> > VB- Hide quoted text -
>
> - Show quoted text -

Reply all
Reply to author
Forward
0 new messages