I created a service in C# which generated an executable "GodzillaService.exe". The service itself is just a basic template generated EXACTLY according to this link, other than the name: https://www.c-sharpcorner.com/article/create-windows-services-in-c-sharp/
The issue comes when I try to run InstallUtil. Per the article above, I execute
cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
on an elevated command prompt, run as administrator. I then type in
InstallUtil.exe C:\Path\To\My\EXE\Godzilla.exe
and I get hit with this error:
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.
Looking at the error message, experience tells me that I need to grant access to something or someone, but what? I'm already running the program as an administrator. I've tried these things so far:
- Run command prompt as administrator.
- Run Developer Command Prompt for VS 2017 as administrator.
- Log out of my user account, log in to my admin account, and try running it.
- Move the GodzillaService.exe file into Program Files directory in case applocker is messing with it.
- Run VS 2017 as admin, rebuild the exe file, then try it.
- Try using the full path of both the exe file and InstallUtil.
- Made sure my admin account was in the local admin group.
- Tried looking at Event Viewer for more information (did not find any logs related to this issue, maybe I'm looking in the wrong place?)
- Tried changing the account in the service program from LocalSystem to User, LocalService, and to NetworkService
I'm fresh out of ideas... Does anyone have any suggestions for what I can do to further troubleshoot this problem? I appreciate any advice given!