title: Run Windows service from ASP.NET
body: <p>I am trying to start/stop service form ASP.net (webform). But when I start my code, I get exception </p>
  
  <blockquote>
    <p>"<strong>Either a required impersonation level was not provided, or the provided impersonation level is invalid</strong>". </p>
  </blockquote>
  
  <p>But when I try to start this one service from Management console it start "OK" without any error. This service is run from "Adm" local user.
  OS is Windows 10.</p>
  
  <pre><code>Impersonate context = new Impersonate(".", "Adm", "5555");
  if (context.impersonateValidUser())
  {
      ServiceController service = new ServiceController("Test");
      service.Start();
  }
  </code></pre>