Win 7 - Windows Service Installation Error - System.InvalidOperationException


I was getting the following error when i tried to install a simple WCF service as part of Windows Service in my machine which has WIN 7 as the operating system.

An exception occurred during the Install phase.
System.InvalidOperationException: Cannot open Service Control Manager on computer '.'. This operation might require other privileges.

The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: Access is denied.

After lot of searching i found out there was one basic permission issue, When installing the Windows Service in a WIN 7 machine.

Solution:-

When using the InstallUtil command to install the service, we need to run the "Visual Studio Command Prompt(2010)" as an Administrator.

Then the Visual Studio Command Prompt window will open and you can write the InstallUtil command to install the Windows Service in your machine:-

This works fine for me. I didn't change any setting using the Registry.

Happy Coding..........

Comments