When I try to start a service I created in Visual Studio I receive the following error:
System error 5 has occurred. Access is denied.
I am running the command line with elevated privileges, so it's not that problem. Is there any place I can look to see what error is occuring.
If you are getting this error on a server machine try give access to the folder you got the real windows service exe. You should go to the security tab and select the Local Service as user and should give full access. You should do the same for the exe too.
Error Code 5 is a Windows error code that appears when the user does not have sufficient permission to access the requested file or location. It appears when the software was denied access to a location for the purposes of saving, copying, opening, or loading files.
Right-click Visual Studio <VersionNumber>, select Change, and then select Repair to initiate the repair process.
To get it to work I needed to add permissions to the output bin\debug folder for my service project.
The Local Service account didn't have permissions to the output .exe file, and this was why the error was occuring.
Had the same issue.
Fixed by running the service under "Local System Account"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With