title: The service could not be started, but does start?
body: <p>I've written a small windows service that I want to run daily on my Windows Server 2008. The service is written in C#.</p>
  
  <ul>
  <li>The code works great in a normal
  Windows Form. </li>
  <li>The service works like it should when I start and stop it from the Services Management window (services.msc).</li>
  </ul>
  
  <p>But when running it on a commandline with:</p>
  
  <pre><code>net start Service1
  </code></pre>
  
  <p>I get the the following:</p>
  
  <pre><code>The Service1 service is starting........  The Service1 service could not be started.
  
  The service did not report an error.
  
  More help is available by typing NET HELP:SG 3534.
  </code></pre>
  
  <p>The weird thing is though, the service is still running, in the Services screen I still see it as starting untill it's fully started. When I try to stop the service afterwards I get:</p>
  
  <pre><code>The service could not be controlled in its present state.
  
  More help is available by typing NET HELPMSG 2189
  </code></pre>
  
  <p>And then the service is stopped. Is there any way in solving this? I've already managed to debug the service without any problems, the code works. But during debugging the same thing still happens on the command console, while I'm still able to debug further.</p>
  
  <p>It's like there is some kind of timeout on the onStart() method.. I have no idea.. I'm fairly new to Windows Services (this is my first one). I do write all my code in the onStart() method, maybe that's not the best idea, but I don't know where else to type it.</p>
  
  <p>If someone could help I'd greatly appreciate it.</p>