title: Multiple Windows Services in One exe
body: <p>I am trying to build several Windows services to do different things.  For instance, I need Windows services that will:</p>
  <ol>
  <li>Send a daily report via email</li>
  <li>Periodically cleanup some archived info every 30 minutes</li>
  <li>etc.</li>
  </ol>
  <p>The tasks I need the windows services to do are distinct so I don't really like the idea of having them all in one service.</p>
  <p>What I've got so far is a project in Visual Studio 2008.  I've created a windows service, I've set up a timer on the OnStart event (it just writes to a text file every 5 seconds for testing purposes).  I then added an Installer to the project and when I run InstallUtil.exe, everything works fine.</p>
  <p>The problem comes in when I add a second windows service to the same project.  I set up the OnStart code again, with the same logging info (slightly different so I can tell which service is writing to the log).  With the second windows service, I changed the Main event in Program.cs from:</p>
  <pre><code>    static void Main(string[] args)
      {
          ServiceBase[] ServicesToRun = new ServiceBase[] 
          { 
              new Service1()
          };
  
          ServiceBase.Run(ServicesToRun);
      }
  </code></pre>
  <p>to:</p>
  <pre><code>    static void Main(string[] args)
      {
          ServiceBase[] ServicesToRun = new ServiceBase[] 
          { 
              new Service1(),
              new Service2()
          };
  
          ServiceBase.Run(ServicesToRun);
      }
  </code></pre>
  <p>At this point, there are no compile time errors, but the Service2 service never does anything...the logging task never fires.</p>
  <p>I narrowed it down to the fact that the second service has no &quot;Installer&quot; associated with it. I then tried to add an Installer the way I did with the first service (i.e., right click on the service designer, and click &quot;Add Installer&quot;).  Now, when I go to the ProjectInstaller.cs file, there is another serviceInstaller there (serviceInstaller2).</p>
  <p>Now when I build the project and try to install the services, and I go to the &quot;Services&quot; control panel window, and I try to start Service1, I get the following error message:</p>
  <blockquote>
  <p>Windows could not start the Service1 service on the Local Computer.</p>
  <p>Error 1083: The executable program that this service is configured to run in does not implement the service.</p>
  </blockquote>
  <p>I get the same error message if I try to start Service2 as well (with the exception that the error message identifies Service2, of course).</p>
  <p>Is there something I am missing in order to get two services running from one exe?</p>