0

I need to track changes in network drive (Z:) using FileSystemWatcher in C#.

When I try to set the Path property of FileSystemWatcher in Wndows form application everything OK.

But when I try to do the same action in my Windows Service application I recieve an Error message in journal

"Unable to start the service. System.ArgumentException: The folder Z:\ is not allowed in System.IO.FileSystemWatcher.set_Path(String value)". 

How can I fix this?

leppie
  • 115,091
  • 17
  • 196
  • 297
  • 1
    The problem is, that mapped network shares are only visible to interactive sessions, which services typically don't have. You can read the answers to this question (maybe there is one that helps you): stackoverflow.com/questions/182750/map-a-network-drive-to-be-used-by-a-service/ – Thomas Lielacher Dec 17 '14 at 07:55
  • You might try to use UNC path directly. But note that remote watching FCN is very expensive and you should avoid using it heavily. – Lex Li Dec 17 '14 at 12:45

0 Answers0