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.


Article by Vaishali Jain
Miss. Jain Microsoft Certified Technology Specialist in .Net(Windows and Web Based application development)

Follow Vaishali Jain or read 127 articles authored by Vaishali Jain

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: