简体   繁体   English

Process.Start() 工作但没有 window 弹出

[英]Process.Start() working but no window is popping up

I have a web API project that has a call that allows the user to basically start a separate application on the server.我有一个 web API 项目,它有一个调用,允许用户基本上在服务器上启动一个单独的应用程序。

Basically my web API is a gateway to remotely call this application from an MVC project.基本上我的 web API 是从 MVC 项目远程调用此应用程序的网关。

Problem:问题:

The problem I am facing is that the Process.Start() method is working perfectly (as in I can see the process starting on the server's task manager) but no window is popping up?我面临的问题是 Process.Start() 方法运行良好(正如我可以看到在服务器的任务管理器上启动的进程)但没有 window 弹出? I can run the application directly and see it start in its own window.我可以直接运行应用程序并看到它以自己的 window 启动。

Web API Code: Web API 代码:

public void ReconnectEPLAN()
{
    if (CheckEplanConnection() == false)
    {
        Process process = new Process();
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.FileName = @"C:\Program Files\EPLAN\Pro Panel\2.8.3\Bin\W3u.exe"; //works but no ui poopup
        process.StartInfo.CreateNoWindow = false;
        process.Start();
    }
}

What can I do to force the started process's app window to appear as well?我该怎么做才能强制启动进程的应用程序 window 也出现?

On your server, IIS runs as a service (unlike IIS Express, which runs in the user space).在您的服务器上,IIS 作为服务运行(与在用户空间中运行的 IIS Express 不同)。 Since Windows Vista, services can no longer interact with the user's desktop directly.由于 Windows Vista,服务不能再直接与用户的桌面交互。

See:看:

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.服务根本无法直接与用户交互:这是因为服务可以在根本没有用户登录的机器上运行,因此无法与它们交互。

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

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