NickCasablancas
NickCasablancas

Reputation: 21

Process.Start() issue - No GUI displayed

I'm trying to launch a WPF .exe from my VisualWebGUI (winforms on the web basically) application. Everything works fine when I run it through 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. 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?

Upvotes: 2

Views: 2606

Answers (2)

Roman Polunin
Roman Polunin

Reputation: 98

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.

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

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. When you use IIS, your primary assumption must be that there is nobody looking at the server screen.

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.

Upvotes: 0

NKnusperer
NKnusperer

Reputation: 984

That's may because the application is started under the AppPool identity (e.g. ApplicationPoolIdentity). Try to set the Identity under "Advanced Settings" for the AppPool to the User that is logged in and should see the application.

Upvotes: 0

Related Questions