title: How to make windows service run from the UI in windows server 2012 R2
body: <p>I am setting up a windows service on windows server 2012 R2. When I install the service to my computer(win10 Entr.) it works perfectly fine. I can start and stop the service from the UI which is installed with the service. However, 
  if I install the service and the UI to the windows server 2012 R2 my logs show me that it is not able to stop the service from the UI. In the UI, when I click on the "stop" button, the code below works.</p>
  
  <pre><code> ServiceController sc = new ServiceController();
   sc.ServiceName = "xxService";
   if (sc.Status == ServiceControllerStatus.Running)
   {
  
       try
       {
  
          sc.Stop();
          sc.WaitForStatus(ServiceControllerStatus.Stopped);
          return true;
       }
       catch (InvalidOperationException e)
       {
          return false;
       }
    }
  </code></pre>
  
  <p>I am wondering if I have to handle something for the server side. It seems like the code above cannot stop the service.</p>