相关疑难解决方法(0)

FileSystemWatcher无法访问网络驱动器

我试图使用Windows服务在某些服务器路径上运行文件观察程序.我正在使用我的Windows登录凭证来运行该服务,并且能够从我的登录中访问此"someServerPath".但是,当我从FileSystemWatcher那样做时,它抛出:

目录名\ someServerPath无效"异常.

var fileWatcher = new FileSystemWatcher(GetServerPath()) 
    {
        NotifyFilter=(NotifyFilters.LastWrite|NotifyFilters.FileName),
        EnableRaisingEvents=true,
        IncludeSubdirectories=true
    };

public static string GetServerPath() 
{
    return string.Format(@"\\{0}", FileServer1);              
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮我这个吗?

c# windows-services filesystemwatcher

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

c# ×1

filesystemwatcher ×1

windows-services ×1