17 June 2010

Timer Control problem in Windows Service

Today I spent a few hours to figure out timer control to work in windows service. Finally, I figured out it's the bug in VS 2008 toolbox.

The timer use in windows service should be system.timers.timer, not system.windows.form.timer. The system.timers.timer should be in Component toolbox. But even I drag from Component toolbox, it still system.windows.form.timer control. So I manually changed in designer.cs and finally work. =)

Note: When you install the window service in windows7 and windows2008, you need to run the vs2008 console with administrator right.

here is the command to install window service

installutil servicename.exe

to uninstall the window service:

installutil -u servicename.exe

No comments: