Process.Start() 工作但没有 window 弹出
Process.Start() working but no window is popping up
我有一个 Web API 项目,它有一个调用,允许用户基本上在服务器上启动一个单独的应用程序。
基本上我的网站 API 是从 MVC 项目远程调用此应用程序的网关。
问题:
我面临的问题是 Process.Start() 方法运行良好(因为我可以看到进程在服务器的任务管理器上启动)但没有弹出 window?我可以直接 运行 应用程序并看到它自己启动 window。
网页API代码:
public void ReconnectEPLAN()
{
if (CheckEplanConnection() == false)
{
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = @"C:\Program Files\EPLAN\Pro Panel.8.3\Bin\W3u.exe"; //works but no ui poopup
process.StartInfo.CreateNoWindow = false;
process.Start();
}
}
我该怎么做才能强制启动进程的应用 window 也出现?
在您的服务器上,IIS 作为服务运行(与 IIS Express 不同,后者在用户 space 中运行)。
自 Windows Vista 起,服务无法再直接与用户桌面交互。
参见:
- How to run console application from Windows Service?
- https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/f8f91e8f-5954-43a7-8bc4-80ed2ff1e3b1/quotallow-service-to-interact-with-desktopquot-does-not-work-on-vista?forum=windowssdk
- https://www.codeproject.com/Questions/1239551/Why-does-process-start-goes-to-background-when-sta
Services cannot interact directly with the user at all: this is because services can run on a machine that doesn't have a user logged in at all, so there is no way to interact with them.
我有一个 Web API 项目,它有一个调用,允许用户基本上在服务器上启动一个单独的应用程序。
基本上我的网站 API 是从 MVC 项目远程调用此应用程序的网关。
问题:
我面临的问题是 Process.Start() 方法运行良好(因为我可以看到进程在服务器的任务管理器上启动)但没有弹出 window?我可以直接 运行 应用程序并看到它自己启动 window。
网页API代码:
public void ReconnectEPLAN()
{
if (CheckEplanConnection() == false)
{
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = @"C:\Program Files\EPLAN\Pro Panel.8.3\Bin\W3u.exe"; //works but no ui poopup
process.StartInfo.CreateNoWindow = false;
process.Start();
}
}
我该怎么做才能强制启动进程的应用 window 也出现?
在您的服务器上,IIS 作为服务运行(与 IIS Express 不同,后者在用户 space 中运行)。 自 Windows Vista 起,服务无法再直接与用户桌面交互。
参见:
- How to run console application from Windows Service?
- https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/f8f91e8f-5954-43a7-8bc4-80ed2ff1e3b1/quotallow-service-to-interact-with-desktopquot-does-not-work-on-vista?forum=windowssdk
- https://www.codeproject.com/Questions/1239551/Why-does-process-start-goes-to-background-when-sta
Services cannot interact directly with the user at all: this is because services can run on a machine that doesn't have a user logged in at all, so there is no way to interact with them.