I am creating another windows service and my timer is not ticking and I have no idea why! I am using system.timers.timer as I have in previous services and it doesn\'t work. I
It looks like it works but you probably a better way to debug it. Who knows maybe your eventLog1
is null
Update your onstart to include this
protected override void OnStart(string[] args)
{
foreach (string arg in args)
{
if (arg == "DEBUG_SERVICE")
DebugMode();
}
#if DEBUG
DebugMode();
#endif
eventLog1.WriteEntry("Service Started");
timer1.Elapsed += timer1_Elapsed;
timer1.Interval = 10000;
timer1.Enabled = true;
}
private static void DebugMode()
{
Debugger.Break();
}
Now when you hit start on the service you'll get a dialog asking if you want to attach. Its way easier then trying to attach manually.