Tag: 文件系统守望者

FileSystemWatcher无法访问networking驱动器

我试图运行一个文件观察者通过使用Windows服务的一些服务器path。 我使用我的Windowslogin凭据来运行服务,并能够从我的login访问这个“someServerPath”。 但是,当我从FileSystemWatcher这样做时,会抛出: 目录名\ someServerPath无效“exception。 var fileWatcher = new FileSystemWatcher(GetServerPath()) { NotifyFilter=(NotifyFilters.LastWrite|NotifyFilters.FileName), EnableRaisingEvents=true, IncludeSubdirectories=true }; public static string GetServerPath() { return string.Format(@"\\{0}", FileServer1); } 任何人都可以帮我这个吗?