0

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

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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