0

Here is situation:

I have a large collection of videos on a computer, and it will be hooked up to my TV. I would like to make an app to open my videos on my computer from my mobile device (Yes, I know it exists, I am just working on it for fun)

So I have setup a web service, and an app to consume said webservice. The webservice gathers a list of folders/files, and sends them to my device as well as can take in a file path and open it with the default program using System.Diagnostics.Process.Start(path)

When I am using IISExpress, it works fine, but I would like to use IIS. When I use IIS, I open the video file and hear it playing in the background, but it doesn't show up on the monitor. VLC appears in the task manager, and when I kill it, the sound stops.

I'm assuming the issue is the identity under which the app pool is being run, but when I tried to change the identity, it didn't make any difference. If it helps, I am running Windows 8. Does anybody have any thoughts on how I can make the app pool run under my identity, or open the process on the desktop of the active user, rather than open it under the app pool's name?

Dan Drews
  • 1,966
  • 17
  • 38

2 Answers2

1

With regards to the Process.Start() problem I think in addition to changing the identity of the application pool you also need to go to Services under Administrative Tools and check the box "Allow the service to interact with desktop" under the Log On tab for the World Wide Web Publishing service. I think this has already been addressed in the following question: System.Diagnostics.Process.Start not work from an IIS

Now, if I had to put an app like this together I would try I slightly different approach: in addition to what you have already, I would build a small desktop app that autostarts and sits in the system tray when you log onto your desktop. It will listen for messages from the asp.net application on named pipes or tcp or something similar and start the processes from within the correct user context. That seems a more stable approach, which will also allow you to separate the web server from the desktop where the videos will be played.

Community
  • 1
  • 1
Oggy
  • 1,516
  • 1
  • 16
  • 22
  • Unfortunately, that did not seem to work. I could see the "Pick an App" (Or however the program is worded for choosing default programs) in the task manager, but it didn't appear. I like your other idea, but my goal was to keep it simple. I'm just switching to Plex :) – Dan Drews Jun 21 '14 at 23:59
  • What you suggest in paragraph 1 won't work as there is session isolation. The paragraph 2 suggestion is doable but still complicated to code. – Lex Li Jun 22 '14 at 01:48
1

This is something rather difficult to implement due to Windows session isolation. IIS as well as its worker processes are in session 0, while your logon session is usually > 0. Via native Win32 API it is possible for something in session 0 to launch executable in other sessions, but I don't think it is worth the while.

Please use IIS Express, as it runs in your logon session directly, and don't need to cross the session boundary at all.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • This may be a dumb question, but is there a way to run IIS Express without VS running? – Dan Drews Jun 22 '14 at 01:57
  • You probably should spend some time on IIS.net to fully learn IIS Express, http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-from-the-command-line – Lex Li Jun 22 '14 at 01:58