Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've written a simple Windows Service which polls a UNC path every few [5] seconds. When it finds a particular sub-directory in that folder it moves it.

The code doesn't have any locking functionality built in, and if I run the process on a local path all is well.

If I try and access the network path when the service is running Windows states that the path cannot be found, the moment I stop the service its available again.

All my code is just wrapped in a simple:

if(Directory.Exists("xxxxx")) { }

Is there any standard mechanism that can keep a 'watched' directory unlocked? BTW - the user account that is running the service is LocalSystem

Many thanks

share|improve this question
up vote 2 down vote accepted

I'm not sure how LocalSystem will ever see the UNC path. LocalSystem does not have access to network resources. Try changing the service to run as an account that has access to the UNC path you're polling.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.