Starting Windows Service fails: 'access denied'
Hi, Gurus!
I have created a windows service in C#.
My problem:
I can install it with installutil.exe but when I try to start it, I get an 'Error 5: Access denied' messagebox!
Here some System-Info:
+ My OS is Windows 2000.
+ Net-Framework-Version is v1.1.4322.
+ I'm logged on as an administrator and have full access to the windows-installer-folder, so this cannot be the reason for the error.
TIA for Your help!
Mikey :confused:
Re: Starting Windows Service fails: 'access denied'
I had the same problem with starting a basic windows service I created in vb.net. This is what worked for me. The folder where the executable resided security was setup inproperly. When I checked the properties page for the folder and went to the security tab and clicked on everyone. Everyone only had list folders rights when I changed this to full control, I was able to run the service as a localsystem.
Re: Starting Windows Service fails: 'access denied'
Add these lines to your projectinstaller class in the InitializeComponent method:
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
This will allow your service to run under the local account.