0

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

Installing service SrvConfigurationManager...

Creating EventLog source SrvConfigurationManager in log Application...

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.

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 Network-Service in Security and Application in Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog in Registry Editor. Even though the same error persist.

I am trying to install window service like this from Command Prompt:

  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "F:\Projects\ConfigManager\bin\Debug\SrvConfigurationManager.exe"

I have also tried to create the event log using this reference but the result is same.Now my question is:

  1. Anything wrong with my installation?
  2. How do I install Windows Service?

Reference taken from

How to: Install and Uninstall Services

How to create a setup project for a Windows Service application in Visual C#

Eventcreate

Community
  • 1
  • 1
Iswar
  • 2,211
  • 11
  • 40
  • 65
  • Are you running as administrator? – pmcilreavy Mar 10 '18 at 05:56
  • Yes I am running cmd as administrator. – Iswar Mar 10 '18 at 05:59
  • Did you restart OS? – Adam Shakhabov Mar 10 '18 at 06:12
  • Why are you doing that using cmd? Can't you create a setup project for your service? – Mohammad Ali Mar 10 '18 at 06:14
  • @ adamshakhabov I have restarted OS for several times. @Mohammad Hamoud I have created the setup but it says that `cannot start service from the command line or a debugger. A windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Service Administrator tool or the NET START Command` – Iswar Mar 10 '18 at 06:19
  • No, you are opening the service file check this out https://support.microsoft.com/en-ie/help/816169/how-to-create-a-setup-project-for-a-windows-service-application-in-vis – Mohammad Ali Mar 10 '18 at 06:20
  • I have tried to create setup also but the result is same – Iswar Mar 10 '18 at 07:26

1 Answers1

0

Just run Developer Command Prompt for VS as Administration. It will solve the problem of

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, State.

Mustafa Poya
  • 2,615
  • 5
  • 22
  • 36