title: C# Windows Service -- the service on local computer started and then stopped?
body: <p>I am trying to create my first Windows Service, but so sad... after I started the service manually from services.msc, the message 'the service on local computer started and then stopped. some services stop automatically is they have no work to do'</p>
  
  <p>I am sure there must be some mistake in my code...</p>
  
  <pre><code>namespace ConvertService
  {
  public partial class Service1 : ServiceBase
  {
      public Service1()
      {
          this.ServiceName = "ConvertService";
          this.EventLog.Log = "Application";
      }
      static void main()
      {
  
          ServiceBase.Run(new Service1());
      }
  
  
      protected override void OnStart(string[] args)
      {
          Process pMP3 = new Process();
          pMP3.StartInfo.UseShellExecute = false;
          pMP3.StartInfo.RedirectStandardOutput = true;
          pMP3.StartInfo.FileName = @"d:\...path...\converter.exe";
          pMP3.StartInfo.Arguments = @"d:\...path...\tempamr.amr " + @"d:\...path...\tempmp3.mp3 " + @"-cmp3";
          pMP3.Start();
          pMP3.WaitForExit();
          Process pWAV = new Process();
          pWAV.StartInfo.UseShellExecute = false;
          pWAV.StartInfo.RedirectStandardOutput = true;
          pWAV.StartInfo.FileName = @"d:\...path...\converter.exe";
          pWAV.StartInfo.Arguments = @"d:\...path...\tempmp3.mp3 " + @"d:\...path...\tempwav.wav " + @"-cwav";
          pWAV.Start();
          pWAV.WaitForExit();
  
      }
  
      protected override void OnStop()
      {
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Forgive me if i did silly mistakes. This is my very very first Windows Service.</p>
  
  <p>PS. I have already ticked 'Allow service to interact with desktop'</p>