我试图使用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)
有人可以帮我这个吗?