Alexander Cherny wrote:
> hi all!
>
> i've created a windows service written on c#. i've added some methods
> into the "main" class inherited from
> System.ServiceProcess.ServiceBase. is there any way to get an access
> to them from any other .net application? when i try to add a
> reference using the service's exe file as a source, i get a message
> like "a reference to '...' could not be added. this is not valid
> assembly or COM component. only assemblies with extention 'dll' and
> COM components can be referenced.", etc.
>
> so how can i get an access to the methods and properties of my
> service from other .net applications?
It all depends on what you want to do. ServiceController allows you to
'send' a custom 'control message' to the service through ExecuteCommand,
this is handled by your implementation of ServiceBase.OnCustomCommand.
ExecuteCommand goes through the Service Control Manager, os it can be called
by another process. Of course, you cannot pass data or get results through
this method. To do that you should either implement the service as a .NET
remoting server (as has been suggested) or you could use the .NET sockets
classes and implement a socket server. This second option has the advantage
that any code can call the socket server.
Richard
--
my email
(E-Mail Removed) is encrypted with ROT13 (
www.rot13.org)