Solved it by calling a timer event directly only when Environment.UserInteractive. The while-loop continued running until the queue was empty. So I am looking for an answer to one of these two questions: But the application listens normally if i run it as a console application.
Trying to work around this problem, I changed it to 'Network Service', so it started normally, but the application was not listening in the port I set when I checked in the prompt with the command 'netstat -an'.
I followed all the steps in How to create Windows Service and chose the account as 'Local System', but when I install in my server machine and push the start button it takes a while and gives the following error:Įrro 1053: The service did not respond to the start or control request in timely fashion.Īfter that, the service status stays stuck in 'starting' and the application don't work and I can't even stop the service anymore. I developed a http server via console application in C# and decided to turn it into a Windows service to be able to initialize it without the need to login the machine.