Error when deploying a Windows Service: An exception occurred during the Install phase.
Error when deploying a Windows Service: 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. at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)
I opened Visual Studio Command Prompt and went to my windows service location where the .exe file of the Windows Service is available ...bin/debug folder and ran the below command to deploy the Windows Service:
C:\Users\Admin\Documents\Visual Studio 2012\Projects\MyDemoService\bin\Debug>installutil demoservice.exe
This has thrown an error when deploying a Windows Service: 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. at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)
Solution to this error is :
Run the Visual Studio Command Prompt as an administrator. Right Click Visual Studio Command Prompt and select run as administrator. This opens Visual Studio command prompt with administrator privileges who has the authority to run the installutil command. This will install the Windows Service properly without any errors.