Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.