Re: Make a Windows Service start a windows program.




"deko" <deko@xxxxxxxxxx> wrote in message
news:fb6dnSB8jemRLWHeRVn-jg@xxxxxxxxxxxxxx
|> Well I mean that it's possible for the program that gets launched from a
| > Windows Service session, to load the environment and profile of an
| > interactive user, it's also possible to migrate the current desktop to
the
| > (visble) interactive desktop, but this is not a trivial task and
requires
| > some thorough understanding of the OS security system.
|
| I see.
|
| > | I have a similar situation where a service needs to instantiate an
| > object
| > | contained in a WinForms app. The service and the app are installed as
a
| > | pair; the UI is used to define the action taken by the service at
| > | pre-defined intervals.
| > |
| >
| > I suppose you mean instantiate an object through remoting right? This is
| > not
| > a problem as long as the WinForms app is started from an interactive
logon
| > session and not from the service.
|
| Well, that's the key question - can I do this without remoting?
|
| The service in question will run as a Local Service since it requires full
| system privaleges, but it gets launced (only) when a particular user logs
| in.


Services aren't lauched when users logs in, services are lauched at system
start-up, Applications that depend on interactive logon session, should
never be implemented as Windows Services, they should be normal applications
that get started at logon (search for Autorun in windows help).




The UI is run in the user's security context so only that user can
| adjust the parameters of the app's "projects" which are launched by the
| service. The "projects" are designed to run silently in the background in
a
| separate thread and require no interaction with the UI (that's why I am
| using a service).
|
| However, the service needs to instantiate the Project object in the
WinForms
| application - this contains all the business logic. So the service needs
to
| pass parameters to the Project class's constructor. That's why I thought
| the service and the app should be in the same assembly.
|

The applications should run in separate processes, so you need a 'way' to
create remote instances of classes residing in a Winforms application. One
way is through remoting (assumed both are managed apps.) and another one is
through COM interop.
One question remain, what's the use of the object instance from the UI
applications perspective? You said, the service creates an instance of class
'Project', how are you going to share the state between these two
applications?


| So do I really need Remoting here? I just want to instantiate the app's
| Project object from the service to allow the app's "project" to run in the
| service's thread and security context, while the app's UI is run in the
| users's thread and security context.
|
| Does this sound correct?
|


Willy.


.



Relevant Pages

  • Re: static vs appsession
    ... if i wanted to instantiate my business class just once is there a ... A Session variable would be visible to a single session only (and ... Hans Kesting ... I think the OP means the Application object, not Session object. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: static vs appsession
    ... rodchar laid this down on his screen: ... if i wanted to instantiate my business class just once is there a difference between making a static variable out of it and putting it in say application session? ... A Session variable would be visible to a single session only ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Object across pages
    ... If you store it in Session, ... > dim name as string ... > 1) How do I declare or instantiate my class so that it can be accessed ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Long process might fail...how to implement a timeout?
    ... > instantiate an object (third party -- I have no control over it) and ... > then tell it to connect to its data source (again, no control over it). ... Don't suppose you have the code for that 'Session' object eh? ...
    (microsoft.public.vb.general.discussion)
  • Re: instantion of class at class level or in new()?
    ... thank you Marina. ... >> Public Class Controller ... >> I am creating a windows service and I want to make sure I am being ... >> Should I instantiate HelperClass at the class level as I have it now or ...
    (microsoft.public.dotnet.languages.vb)