I've a running service on Windows Server 2012 called FileWatcher. It checks files into folders and does other stuff. I have to stop and restart the service every day at 2.00 AM so i configured two scheduled tasks: the first one stops the service at 2.00 AM, the second one starts it at 2.01 AM.
Everything is working. The service stops, then it restarts. But if I check the Event Viewer I find some errors.
What's going on? I mean, the service stops and restarts, why I get these errors? I already checked in another similar question, and the guy solved changing the project from Windows Application to Console Application. Mine was already Console App.
Thank you in advance, M.
Can you repeat the error when you run / stop service by hand? Can you find the line, where this happens?
Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
This is a wild guess, but you have Console.ReadKey()
somewhere in your service.