c# - System.ComponentModel.Win32Exception (0x80004005) : No such interface supported

标签 c# .net process windows-server-2008

Windows 服务启动的程序出现问题。

流程是

  • exe 启动
  • 将自己重命名为 *.bak
  • 自己下载最新版本
  • 调用Restart()
  • 执行大量文件和 SQL 操作(更新我们的主要软件套件)
  • 然后调用 Restart()
  • 流程再次开始。如果主套件没有软件更新,它不会重新启动

除一个客户站点外,这一切都完美无缺

在一个网站上,第一个 Restart() 有效,但第二个总是抛出异常。

System.ComponentModel.Win32Exception (0x80004005): No such interface supported at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at UpdateCompanionService.Program.Restart()

它是一个WS2008标准的服务器。

public static void Restart()
{
  try
  {
      var procPath = Path.Combine(Config.UpdateCompanionDirectory, "UpdateCompanionService.exe");
      Logger.Debug("Starting procecss {0}", procPath);

      var proc = new Process
      {
          StartInfo = {FileName = procPath, WorkingDirectory = Config.UpdateCompanionDirectory, Arguments = "/noupdate", UseShellExecute = true}
      };

      proc.Start();
      Environment.Exit(-1);
  }
  catch (Exception e)
  {
      Logger.Fatal("Error restarting update companion", e);
  }
}

最佳答案

尝试使用

    UseShellExecute = false 

已知可以解决此问题

关于c# - System.ComponentModel.Win32Exception (0x80004005) : No such interface supported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28469809/

相关文章:

c# - 如果 Windows 服务停止,给我发电子邮件

c# - Windows 服务上的本地 Http 服务器

linux - 我可以等待不是当前 shell 终端子进程的进程终止吗?

c++ - 使用fork()和boost::asio的进程池

c# - 从代码隐藏设置对象参数标签

c# - 从那里获取数据然后返回到 Windows 剪贴板

c# - 从 Excel 工作表中读取日期时间值

c# - 必须将单个字符串传递给多个正则表达式模式,并且在匹配时我想要匹配的值

c# - IErrorInfo.GetDescription 因 E_FAIL(0x80004005).System.Data 而失败,而数据适配器 Fill()

c - C 中使用 fork() 和命令行参数的并行进程