Re: Starting exe from WebService
From: Don Dumitru [MSFT] (dondu_at_online.microsoft.com)
Date: Thu, 3 Jul 2003 12:08:56 -0700
Your web service is probably running as a service on the machine, and
services are generally not configured to "interact with the desktop". So a
service can't launch an app, and have that app appear on the desktop of the
Services run on their own "winstations", in security contexts which are
separate from the security context of the user who is logged in on the
console of the machine.
In your case, what is probably happening is that the WinForm app is getting
launched in the service's winstation, and the WinForm's initialization is
failing because it expects a GUI winstation, and the initial calls to the
GUI API are failing.
In general, services should not be making API calls that attempt to interact
with the desktop. For example, which desktop? With terminal services,
there can be multiple people logged in to the machine - one at the console,
and several on remote desktops. In this example, if you were going to
launch a WinForm, which user's "desktop" would you want the WinForm to
Why do you want a WebMethod to launch a WinForm on the server? How do you
envision the user using your application?
-- This posting is provided "AS IS" with no warranties, and confers no rights. "Mazen" <email@example.com> wrote in message news:firstname.lastname@example.org... > Description: I am trying to run a WinForm application > created in C# from a WebMethod by starting a new process > in the Webmethod and performing a Start command on that > process. I wonder if the problem described below is > related to WebService security priveleges. > > Problem: When I invoke the WebMethod, the name of the > WinForm application instantly appears in the Task Manager > processes list and then very rapidly disappears as if an > error occurs. I have added a Thread.Sleep(10000) in the > Form Load event of the application but the name still > diappears quickly from the Task Manager without > performing what i need it to do. > > Additional Information: I tried creating another WinForm > application that has the same code as the Webmethod for > the process initiation and it worked fine (The > application from the process starts and remains listed in > Task Manager). It seems the problem is restricted to the > WebService. Note that I also have changed the > machine.config parameters as follows: > > <identity impersonate=true usrname="" password=""/> > <processmodel ...... username="SYSTEM" ....../> > > I appreciate any insight on this problem. > > Thanks > > Mazen