Groups | Blog | Home
all groups > dotnet remoting > may 2005 >

dotnet remoting : Best way to auto-start Remoting host that is a Windows Forms app?


Daniel Moth
5/29/2005 12:00:00 AM
I have not encountered any clean solution to that and I too prefer the COM
autolaunching of out-of-proc servers.

You could have a client-side dll that does the launching of the host process
etc. The requirement now is that the client "touches" the dll before going
anywhere near to the exe (or to be precise, the dll hosted by the exe).

In fact, I have thin proxy objects in my client side dll that simply forward
the calls to the corresponding remoted object and hence the client apps
don't even know/reference the remoted dll - they do everything through the
local dll and the out-of-proc business is transparent. There are other
benefits to that like translating chatty calls to chunky, validating
arguments in-proc etc.

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


[quoted text, click to view]
None
5/29/2005 12:36:54 AM
I have a Windows Forms app. that acts as a Remoting host for my client apps.
I don't really want to turn the host app into a Windows Service if I don't
have to. What are my options for auto-launching the host app when a client
needs it? (the host app already acts as a Singleton so only one instance
will ever run)

I see a couple of options, none very nice:

1) Have the client start the host application. The problem I see with
this is that I have to build in logic in the client to detect that the host
is started and ready.

2) The host application also acts as an OPC server. The clients could
create an OPC connection to the server and Windows will launch the host.
The problem with this is some of my client apps don't really need the OPC
functionality so this is kind of a hack.

3) Create a Windows Service that is nothing but a listener for Remoting
activation requests from the clients. The service will then launch the host
app. Yuck.

Please suggest other options! One nice thing about COM was that Windows
will launch out-of-process servers for you. I wish Microsoft had done the
same thing for Remoting.

None
5/29/2005 10:20:46 PM
Thanks for the info.

Currently I am just trying using Process.Start to launch the host app from
the client app and putting in a short delay with a splash screen and it
works well. Very simple and clean. Eventually I'll do what you do in
wrapping it up into a client-side DLL for reuse and encapsulation.


[quoted text, click to view]

Richard L Rosenheim
5/30/2005 8:29:40 AM
You don't say if the client will always need the Remoting host or not.

If it does, and you just want to launch both programs at the same time, you
could create a batch (or script) file that is used to invoke both of the
programs. Instead of the menu or desktop icon referencing the client app
directly, have the link reference the batch file instead. Then, when the
user runs the app, the batch file can load both programs.

If you want the host to always be loaded, there are a number of ways of
doing that. If you only want the host to run when the user is logged in,
you can put it in the user's start up menu folder. If you want the host to
start running when the computer is booted, you can use the Window's
Scheduler to load the program at boot time.

BTW, The logic for determining if a Windows application is running is not
that complicated. Just enumerate through the top-level windows and check
the form's caption. If you find a window with the appropriate caption, then
the application is running.

Just some suggestions,

Richard L Rosenheim


[quoted text, click to view]

Daniel Moth
5/30/2005 10:58:43 AM
Yup the Process.Start is what I use as well. For the short delay, you may
want to check the WaitForInputIdle method (if you haven't already)

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


[quoted text, click to view]
AddThis Social Bookmark Button