简体   繁体   English

Process.Start()问题-没有显示GUI

[英]Process.Start() issue - No GUI displayed

I'm trying to launch a WPF .exe from my VisualWebGUI (winforms on the web basically) application. 我正在尝试从VisualWebGUI(基本上在网络上为winforms)应用程序启动WPF .exe。 Everything works fine when I run it through VS2010. 当我在VS2010中运行时,一切正常。 However when I deploy the site to IIS it does launch the .exe (I can see it writing out to a log file) but it does not show me the GUI of the WPF app. 但是,当我将站点部署到IIS时,它确实会启动.exe(我可以看到它写到日志文件中),但没有显示WPF应用程序的GUI。 I can see the process running in Task Manager too! 我也可以看到任务管理器中正在运行的进程! Very simple stuff really, just passing one arguement: 真的很简单,只是通过了一项争论:

Process p = new Process();
p.StartInfo.FileName = Security.ExePath
p.StartInfo.Arguments = ID
p.Start();

I've tried fiddling around with the different startinfo parameters but to no avail, am I missing something? 我尝试摆弄不同的startinfo参数,但无济于事,我错过了什么吗?

That's may because the application is started under the AppPool identity (eg ApplicationPoolIdentity). 这可能是因为该应用程序是在AppPool身份(例如ApplicationPoolIdentity)下启动的。 Try to set the Identity under "Advanced Settings" for the AppPool to the User that is logged in and should see the application. 尝试将AppPool的“高级设置”下的身份设置为已登录的用户,并应看到该应用程序。

You will need to specify proper window station for your process, in order for it to get access to the same UI as your current Windows logon session. 您将需要为您的进程指定适当的窗口站,以便它可以访问与当前Windows登录会话相同的UI。

Look here: http://support.microsoft.com/kb/165194 and read on about Windows API, for example here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682429(v=vs.85).aspx 在这里查看: http : //support.microsoft.com/kb/165194并继续阅读有关Windows API的信息,例如在这里: http : //msdn.microsoft.com/zh-cn/library/windows/desktop/ms682429(v = vs.85).aspx

As a side note, launching GUI from a worker process is a really bad idea - primarily because you never guarantee that there IS any interactive user at any point in time. 附带说明一下,从工作进程启动GUI确实不是一个好主意-主要是因为您从不保证在任何时间点都存在任何交互式用户。 When you use IIS, your primary assumption must be that there is nobody looking at the server screen. 使用IIS时,您的主要假设必须是没有人看着服务器屏幕。

You'll be better off having your GUI application (or a lightweight stub) automatically started up when user logs on, and then listening for signals from the background process. 最好在用户登录时自动启动GUI应用程序(或轻量级存根),然后侦听来自后台进程的信号。

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

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