I have written a windows service which creates a file on local drive (C:\Testing folder).
I have installed this service. I am starting this service from web application hosted in IIS.
If i hardcode this path in service code, the service works fine but if I pass the path through web application to the web service, Events log showing an excepetion
Service cannot be started. System.UnauthorizedAccessException: Access to the path 'C:\Testing' is denied.
I have admin access on my machine and I am starting the service with the same account. How can I get rid of this exception?
Windows Services have existed for over 20 years. They start most often at system startup and run permanently. A Worker Service is also a real process, but is intended as a background service for a front-end application; it starts with the application and stops with the application.
As SpikeX said, your service needs to have read-write access to the folder c:\Testing
Right-click on the folder and change security permissions. "Local Service" for Local System account:
or if your service runs under a specific account (e.g. your own Windows admin account), give that account write permissions to the folder.
The service security tab in Services.msc:
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