title: C# Converting Console App to Service
body: <p>I am trying to convert a console app to a Windows service. I am trying to have the onstart method of the service call a method in my class but I can;t seem to get it to work. I'm not sure I am doing this correctly. Where do I put the class information in the service</p>
  
  <pre><code>protected override void OnStart(string[] args)
  {
     EventLog.WriteEntry("my service started");
     Debugger.Launch();
     Program pgrm = new Program();
     pgrm.Run();
  }
  </code></pre>
  
  <p>From the comment:</p>
  
  <pre><code>namespace MyService {
   static class serviceProgram {
    /// &lt;summary&gt; 
    /// The main entry point for the application. 
    /// &lt;/summary&gt; 
    static void Main() {
     ServiceBase[] ServicesToRun;
     ServicesToRun = new ServiceBase[] {
      new Service1()
     };
     ServiceBase.Run(ServicesToRun);
    }
   }
  }
  </code></pre>