views:

337

answers:

1

I have a program running on my desktop machine that makes a WCF service available. This is a regular Windows Forms application that I run when logged in as a normal user.

I put the WCF interface in so that I could see the status of the program from an external web page. This works great, I can see the status of the running program and even change things as I see fit.

The only thing I can't do is start the program. If I go to the web page and the program is not running, I'd like to be able to start it. A simple Process.Start(programEXE) doesn't suffice because while the program starts, it is not on the desktop and I can't see it, though it does show up in Task Manager.

I tried creating credentials and launching the program with those credentials, but it exits with a very vague "Program failed to start" error, or starts with my credentials but still doesn't show up on the desktop. In the latter case, I see it in Task Manager under my name, but don't see the actual program.

So, How do I start a program on the server, visible on the desktop of the logged-in user (There's only one user and that user is always logged in)?

Also, what are some things that I can do to ensure that this doesn't become a security hole? One thought I had was to run the launcher.aspx in its own virtual directory, under a userid that only has read permissions to the one directory where program.exe is located, and has no other read or write permissions. Any other suggestions?

Finally, just to be clear: I am not trying to launch anything on the user's computer. Clicking on the "launch program" link should launch a program on the web server and not on the client machine, and that program should be visible to the logged-in user on the server.

+1  A: 

I'm almost positive that you can't do that. Your IIS runs as service and does not have a specific desktop environment associated with it. What you're trying to do doesn't really work in the web/server environment.

I'd recommend that you change your win form app to a windows service and then you'd be able to start/stop it via web site. If you enable "interact with desktop" with the windows service then I think you'd be able to have a form.Show() bring the app to the current user's desktop environment.

If you are the only person that needs to run the winform app, then why not just start the app yourself? You state that it'll probably never be used by any computer other than your own computer, so it seems like a complicated method of accessing a local web site to start a local winform app when you could just start the winform app via shortcut.

Jim W
I was afraid the answer would be something like that. Now to look at either rewriting my app as a service, or creating a stub service whose only job is to launch my app...
Aric TenEyck