【问题标题】:System.Diagnostics.Process.Start IssueSystem.Diagnostics.Process.Start 问题
【发布时间】:2009-11-23 22:46:09
【问题描述】:

我似乎对 System.Diagnostics.Process.Start 方法有一个奇怪的问题。我有一个使用 3.5 SP1 .NET Framework 的 C# 桌面应用程序。用户单击一个标签,该标签将存储在其标签中的文件夹路径作为字符串传递给函数。 Windows 资源管理器使用正确的文件夹启动。当此工具安装在 Citrix 上并通过已发布的应用程序运行时,Windows 资源管理器仍会启动,但也会显示 .NET 异常消息“系统找不到指定的文件”。

System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)

文件路径存在,因为它刚刚启动它没问题,并且代码在本地登录到服务器时没有错误,它只是作为已发布的应用程序出错,我的代码在下面

Label label = (Label)sender;
if (label.ForeColor == Color.Blue) {
   if (System.IO.Directory.Exists(label.Tag.ToString()) == false)
   {
      MessageBox.Show("The specified folder does not exist:" + 
            Environment.NewLine + Environment.NewLine + label.Tag.ToString(), "",
            MessageBoxButtons.OK, MessageBoxIcon.Information);
      return;
   }
   System.Diagnostics.Process.Start(label.Tag.ToString()); 
}

我找到了这个页面http://forums.citrix.com/thread.jspa?messageID=1382638,但我们的服务器上并没有 IIS。

有人可以帮忙吗?

谢谢, 抢

【问题讨论】:

  • 你的意思是你已经完成了一个网络部署,以便用户进入一个网页并点击安装?
  • 不,这是一个桌面应用程序,由 Citrix 作为已发布的应用程序发布。桌面应用程序中包含在不同文件夹位置启动 Windows 资源管理器的链接
  • 这些文件夹位于网络驱动器上。完整地址(例如域名等)用于传递给 Start 函数。 Citrix 服务器有权访问文件夹区域。只是为了确认 Windows 资源管理器确实从此功能启动到正确的文件夹。一旦 Windows 资源管理器启动,就会出现异常消息。

标签: c# .net citrix


【解决方案1】:

不要尝试使用文件夹名称启动进程,而是启动进程“explorer.exe”并将文件夹名称作为命令行参数传递。您可以在此处找到 explorer.exe 接受的命令行参数列表:

http://support.microsoft.com/kb/314853

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-22
    • 1970-01-01
    • 1970-01-01
    • 2015-10-27
    相关资源
    最近更新 更多