title: FileSystemWatcher to watch UNC path
body: <p>There are no shortage of questions on this topic, but I'm still having trouble. Here is my situation. I've got a service that I need to watch a path that is specified in the config file. It works great when I used a local drive. </p>
  
  <p>However, when I change it to something like <code>\\server2\secondary\temp\watch_folder</code> the service does not start. The error in the log is </p>
  
  <blockquote>
    <p>The directory name \\server2\secondary\temp\watch_folder is invalid.</p>
  </blockquote>
  
  <p>If I copy that directly into Windows Explorer the folder opens fine. If I take my code and paste it into an old Winforms app it works fine. I've tried all of the "Log On As" accounts. I set it to use the Administrator account, but still no dice.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>_watcher = new FileSystemWatcher();
  _watcher.Path = ConfigurationManager.AppSettings["WatchFolder"];
  _watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
  _watcher.Filter = "*.txt";
  _watcher.Created += new FileSystemEventHandler(OnCreated);
  _watcher.Error += new ErrorEventHandler(OnError);
  _watcher.EnableRaisingEvents = true;
  </code></pre>
  
  <p>Any ideas? I'm at a loss and at this point I think I've been staring at it too long. I sincerely appreciate any help.</p>
  
  <p>Thanks,
  Nick</p>
  
  <p><strong><em>EDIT</em></strong>
  Here is the exception:</p>
  
  <blockquote>
    <p>Service cannot be started. System.ArgumentException: The directory name \server2\Secondary\temp\watch_folder is invalid.<br>
       at System.IO.FileSystemWatcher.set_Path(String value)<br>
       at FileWatcher.FileWatcher.Watch()<br>
       at FileWatcher.FileWatcher.OnStart(String[] args)<br>
       at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)</p>
  </blockquote>