title: How to determine if starting inside a windows service?
body: <p>Currently I'm checking it in the following way:</p>
  
  <pre><code>if (Environment.UserInteractive)
      Application.Run(new ServiceControllerForm(service));
  else
      ServiceBase.Run(windowsService);
  </code></pre>
  
  <p>It helps debugging a little and service can also be run using the executable. But assume now that the service requires interaction with the user desktop so that I have to enable "Allow service to interact with desktop" in the properties. This of course breaks this way of checking. Is there another way?</p>