I see you've fixed the problem; but in reality, you shouldn't normally be running the service from a project's bin folder anyway - the files should be put somewhere project and profile independent (for example, under program files). For debugging purposes (when it will be in the bin folder), you can detect whether it is a service in Main()
, and if it is being run interactively just run the service code directly, rather than the usual service-start setup.
You can detect either by adding a command line argument, or you can try checking Environment.UserInteractive
.