title: Converting my application in a Windows Service
body: <p>I've created a solution with multiple projects. I have one project which is a WPF application. This application communicates with a service-logic-application. That application redirects all traffic to different managers for specific objects. Those managers communicate with a database through a few classes. An other project in the solution is, for example, the projects which can communicate with some hardware I've connected.</p>
  
  <p>How can I convert this solution (minus the WPF application?) to a Windows Service? So that all the things like hardware communication and database saves are still running, and I can start the WPF UI anytime to configure some settings.</p>
  
  <p>I don't really understand how the installer packaging works. I've created a service which creates an instance of the central logic class. This instance should only be created once, and instantiating this class makes sure other  manager classes are started, as well as a databasehandler class and classes which handle events from external hardware. So in short, the application should work when instantiating the central logic class. So all really should be done when starting the service, is instantiating that class. The WPF UI application is only used for configuration and not necessarily needed. </p>
  
  <p>How can I create such service and create an installer for this? It seems that the following code is not enough:</p>
  
  <pre><code>protected override void OnStart(string[] args)
  {
      log.Debug("Starting service...");
      serviceLogic = new CentralLogic();
      log.Debug("Successfully started service");
  }
  </code></pre>
  
  <p>Or that I'm creating the installer wrong. Can anyone guide me in to the right direction?</p>
  
  <p>EDIT: I've looked into it, and it seems I'll be using WCF to let the UI communicate with the service later on. First I'd like to get the service installed on my Windows pc and let it working correctly. When running the solution in Visual Studio, everything works like it supposed to do. The WPF application is the one starting and creating an instance of the CentralLogic class. Even if I don't do anything with the UI after that and only 'play' with the hardware, everything functions. So creating an instance of the CentralLogic class should be enough to have the whole solution running since this class manages other classes. Only creating the installer, service, and perhaps even the building goes wrong with me. I've got no clue what to do here.</p>