Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System error 5 Access is denied when starting a .NET service

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.

like image 635
Daniel O Avatar asked Feb 22 '09 05:02

Daniel O


People also ask

Can't start a service error 5 access is denied?

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.

What is system error code 5?

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.

How do I fix access denied in Visual Studio?

Right-click Visual Studio <VersionNumber>, select Change, and then select Repair to initiate the repair process.


2 Answers

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.

like image 138
Daniel O Avatar answered Oct 04 '22 00:10

Daniel O


Had the same issue.

Fixed by running the service under "Local System Account"

enter image description here

like image 27
Alexander G Avatar answered Oct 04 '22 01:10

Alexander G