0

i wrote a windows service that should monitor a folder and do stuff as soon as a file is copied/moved/created inside that specific folder. My problem is that while I execute the program in a console I'm able to read a shared folder without problems (local, shared, using ip or UNC) instead if I run the same code as a service (with the same user credentials, other user credentials or network service credentials) I'm not able to see the folder. The environment is windows, the specific machine win server 2008R2 the machine is in a domain.

I tried to use this class DirectoryInfo to check the actual path, and as before exists when executed as console and not exist when executed as a service. What am I missing? Also when I execute the service with different credential I'm not able to interact with the server, Is there a way to fix this?

Same behavior on my local machine

1 Answer 1

0

Are you setting the Log On as account in the Properties Log On tab of the service?

17
  • Correct, to set the user I'm setting it there Jul 22, 2014 at 2:43
  • Does that user have the permissions to run as a service? technet.microsoft.com/en-us/library/cc794944(v=ws.10).aspx
    – George
    Jul 22, 2014 at 2:52
  • Yep both of them, the group has been added the first time i tried to run the service. And on local folders the service is working fine. Jul 22, 2014 at 2:56
  • Once the service runs is it authenticating inside your code?
    – George
    Jul 22, 2014 at 2:59
  • Also the accounts that are running the service are they domain or local accounts?
    – George
    Jul 22, 2014 at 3:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .