c# - 从 .NET Windows 服务启动进程

标签 c# .net windows service

我正在尝试从 .NET Windows 服务启动控制台应用程序。该服务在 Windows 2008 服务器上运行。

我使用 Process.Start 来运行控制台应用程序并且它运行了(我可以在任务管理器中看到它),但是我从来没有取回进程 ID 并且对 Process.Start 的调用只是挂起。 如果我从我的 Windows 7 机器运行相同的服务,进程运行并且我得到进程 ID 没有问题。

我很困惑..

最佳答案

我遇到了同样的问题。对我来说,关键是设置 StartInfo.UseShellExecute = false;

关于c# - 从 .NET Windows 服务启动进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2790071/

相关文章:

c# - XML 中缺少标记会阻止 XmlSerializer 创建属性

c# - 将 List<T> 转换为 List<Interface>

C++ 执行 CMD 命令

c# - 如何为 TreeView 中的部分而非所有节点设置图像?

c# - 将数据从 View 绑定(bind)到 ItemsPanelTemplate

c# - 是否可以参数化 nunit 测试

PHP 内置服务器给出 "CLI has stopped working"

c# - 在 C# 中设置风扇速度

C# 问题 : Why cannot I assign a string directly to a class inheriting System. IFormattable 或 System.FormattableString 而它们本身可以吗?

c++ - windows 无法找到 dll,即使它位于 PATH 中的目录中