title: System.Security.SecurityException: An exception occurred during the Install phase while Installing service
body: <p>I am trying to install window service from command prompt. The installation of service is failed because the system throws an security issue. The error is</p>
  <blockquote>
  <p>Installing service SrvConfigurationManager...</p>
  <p>Creating EventLog source SrvConfigurationManager in log Application...</p>
  <p>An exception occurred during the Install phase.
  System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.</p>
  </blockquote>
  <p>Installation is rolling back because the system is not been able to create event log. For the installation I have given the full control to <code>Network-Service</code> in Security and Application in <code>Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog</code> in Registry Editor. Even though the same error persist.</p>
  <p>I am trying to install window service like this from Command Prompt:</p>
  <pre><code>  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe &quot;F:\Projects\ConfigManager\bin\Debug\SrvConfigurationManager.exe&quot;
  </code></pre>
  <p>I have also tried to create the event log using <a href="https://stackoverflow.com/questions/446691/how-to-create-windows-eventlog-source-from-command-line">this</a> reference but the result is same.Now my question is:</p>
  <ol>
  <li>Anything wrong with my installation?</li>
  <li>How do I install Windows Service?</li>
  </ol>
  <p>Reference taken from</p>
  <p><a href="https://docs.microsoft.com/en-us/dotnet/framework/windows-services/how-to-install-and-uninstall-services" rel="nofollow noreferrer">How to: Install and Uninstall Services</a></p>
  <p><a href="https://support.microsoft.com/en-in/help/816169/how-to-create-a-setup-project-for-a-windows-service-application-in-vis" rel="nofollow noreferrer">How to create a setup project for a Windows Service application in Visual C#</a></p>
  <p><a href="https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc755240(v=ws.11)" rel="nofollow noreferrer">Eventcreate</a></p>