views:

1516

answers:

1

I've created a windows service in C# and Windows Server 2003. I would like my service to be able to run an exe file that is Windows forms application. When I start the service - it runs the other application but I cannot see it. When I open Task Manager - i can see that the application is running but I just cannot see it. I have checked "Allow the service to interact with the desktop" but nothing happens. Please help. Is it possible to run and exe from within a windows service and see the exe running in widnows server 2003?

+4  A: 

Showing UI from a Windows service is very problematic because the service may be running on a different desktop from the user (and on Vista/Server 2008 will in fact always run on a different desktop).

The easiest solution is to run the UI not directly from the service but from an application running on the user's desktop (maybe set to run at login) that communicate with the service somehow.

Just remember:

  1. There may be no logged in user
  2. There may be multiple logged in users using fast user switching or remote desktop
  3. The application on the user desktop is running in the user's security context, not the service's
Nir
Good Answer. Perhaps add a recommendation for how to communicate between the service and the desktop application.
Ken