C# Windows Service Access denied when trying to write in a folder
- by Joseph Ghassan
Hi guys,
I have deployed successfully a C# windows service on a windows 7 machine.
Now, when I try to create a file using this code :
FileStream os = new FileStream(String.Format(folderName, fileName), FileMode.Create);
I get Access to filepath is denied.
In the service Installer I set the following parameters to :
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = "Pass";
this.serviceProcessInstaller1.Username = "Administrator"
I added all the possible accounts with Full permissions to the folder where I want to create the file but nothing helped.
Any suggestions would be highly appreciated