Windows Service - Share Instance without Remoting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

Here is a very common scenario. You have a simple windows service which
instantiates a class in order to do some job, let's say... check your e-mail
inbox once every 10 minutes. And suppose that you have a windows application
from which you would like to access that instance and change some settings of
monitor the process.

I have come to the conlcusion that in order to do that (access the same
instance that the windows service has instantiated) you have to use
remoting!!! Is this the only way? If so, why??? Why should I use remoting
(and all that TCP and Serialization stuff) since I'm not calling a remote
process?

In the COM days we could register the COM instance class in the ROT (with
some simple Win32 API) and access that same instance using the GetObject
function (VB6). Isn't there such a feature in the .NET world?

Dimitris
 
..Net remoting is a framework that can be used to communicate between
different AppDomains. I am not sure why you believe 2 separate processes
should be able to communicate to each other without some intermediary
framework, even if they are on the same machine.

..Net remoting sounds like the simplest solution to implement, given your
problem. And it is very simple to use - most of the work could be done in the
config.

HTH
Dan
 
I have come to the conlcusion that in order to do that (access the
same instance that the windows service has instantiated) you have to
use remoting!!! Is this the only way? If so, why??? Why should I use
remoting (and all that TCP and Serialization stuff) since I'm not
calling a remote process?

Remoting works basically the same way... you register the object, and the
client grabs a reference to it. Main difference is that the object must be
created and running for the client to get to it.

If you are worried about using TCP, then hold your breath for .NET 2.0,
which provides IPC Named Pipes channel for remoting. If you aren't picky
about transports, the only bind your server channel to the localhost
address, and other computers on the net shouldn't be able to get to it.

-mdb
 
Back
Top