繁体   English   中英

Process.Start不使用FileCilla的UNC路径

[英]Process.Start not working with UNC path to Filezilla

此代码以下用于安装它的C驱动器。 我们将它移动到UNC路径\\ share,现在它似乎没有重新加载配置文件。 没有错误,Filezilla工作得很好,因为我可以在这个UNC Share上连接和传输文件,但是从代码中我无法实现它实际上已经做的假设了。 我需要明智地做任何特殊凭证吗? 我的网站应用程序池的用户帐户与共享相同。

Process.Start("CMD.exe", "/C \"\\filezilla\\FileZilla Server.exe\" /reload-config");

更新

我从实际计算机上的命令提示符处运行此行,它执行了它的设想。

另一个更新

var path = string.Format("/C \"{0}FileZilla Server.exe\" /reload-config", Config.Paths.FileZillaPath); // \\filezilla\
Process.Start("CMD.exe", path);
Logger.Debug("Path: " + path); // Path: /C "\\filezilla\FileZilla Server.exe" /reload-config

UNC路径中的第一对反斜杠未正确转义,将导致单个反斜杠。 尝试

Process.Start("CMD.exe", "/C \"\\\\filezilla\\FileZilla Server.exe\" /reload-config");

您可以在MSDN上看到一个示例

string g =“\\\\\\\\ server \\\\ share \\\\ file.txt”; // \\\\ server \\ share \\ file.txt

string h = @“\\\\ server \\ share \\ file.txt”; // \\\\ server \\ share \\ file.txt

我做过类似的事,但是这样......

 Process reloadConfig = new Process();
 reloadConfig.StartInfo.FileName = @"\\MachineName\FileZilla Server\FileZilla Server.exe\";
 reloadConfig.StartInfo.Arguments = @"/reload-config";
 reloadConfig.Start();

这对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM