Thursday, February 22, 2007

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.

No comments: