Re: Starting exe from WebService

From: Don Dumitru [MSFT] (dondu_at_online.microsoft.com)
Date: 07/03/03


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
server.

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
appear on?

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" <mazenmanasseh@yahoo.com> wrote in message
news:50f001c3417e$74898480$a401280a@phx.gbl...
> 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


Relevant Pages

  • RE: Opening a MS Access APP - if the SQL connection is not found.
    ... The suggestion about downloading a winform application would not work - as ... Maybe what I'll do is install the winform application to check for the SQL ... server connection and then launch the web page or the Access MDB, ... > that could happen if the browser were to allow a page you visit on the web to ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to design UI
    ... if you have no knowledge and no times to read book is to launch ... VS.NET, start a winform application project and, drag control from the ... > I'm going to start a windows-form application,but I am not very familiar ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Running an exe from WebService
    ... created in C# from a WebMethod by starting a new process ... WinForm application instantly appears in the Task Manager ... performing what i need it to do. ...
    (microsoft.public.dotnet.security)
  • Starting exe from WebService
    ... created in C# from a WebMethod by starting a new process ... WinForm application instantly appears in the Task Manager ... performing what i need it to do. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: How can I raise WinForm from WinService ?
    ... A scervices run before the computer is logged on, therefor, it doesn't have a ... to enable a scerive to interact with desktop you ... this will enable you scervice to interact with the 'default' ... > I cannot use remoting because i need the WinForm on the same process as the ...
    (microsoft.public.dotnet.framework.clr)