I've got a problem with starting automatically my own C# service in win2k8. Basically service it self monitors a folder in a loop for changes (since the file system limitations). When I set service for autostart (or delayed start) it is in started state but does nothing. After that when I restart it manually everything starts working fine...
Here is my onStart method:
protected override void OnStart(string[] args)
{
if (timer == null)
{
timer = new System.Timers.Timer();
timer.AutoReset = false;
timer.Interval = 1;
timer.Elapsed += new System.Timers.ElapsedEventHandler(DoStuff);
}
eventLog1.WriteEntry("In OnStart");
timer.Start();
}