Using Timers with Windows Services in .NET

I was trying to help out a colleague by writing a small Windows service for one of his projects. The requirement was for the project to run periodically in a server and copy some documents from one place to another. Since this was a chance to get my hands dirty with some coding, I jumped at the chance.

Writing the service was a price of cake. But I hit a brick wall. The timer I had used (System.Timers.Timer) was not firing. As usual,I checked the tutorials to see if I was doing it right, and seemed it was all right. But still it was not getting fired when the service is started. So I started digging. And I came up with this article which explains using the Timers with Windows services. Helped me. Hope it helps someone else out there as well.

PS: It feels good to do coding on .NET.




    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s



%d bloggers like this: