Hello, I'm performing some research to determine the feasibility of
developing a Windows Service (see
http://en.wikipedia.org/wiki/Windows_Service for the specific
definition of "service" to which I'm referring) to perform a particular
task. I'm having some trouble determining if a service's
functionality can be accessed in a non-I/O manner (such as avoiding
Sockets, reading and writing a temp file, etc).
Basically, I'd like to call a method on a running service, and have it
return an object (similar to a factory's getInstance method). All I've
been able to find so far is that a service can implement the
"OnCustomCommand" method, which only provides one-way communication
from the caller to the service, allowing an integer argument to be
specified.
A potential solution that I'm currently noodling over is to retrieve an
instance of the service via the ServiceController class, and cast the
resulting object to the specific class of the service which I write.
Unfortunately, I can't test this today, as I have to wait until the
network admin enables the security settings to allow me to install a
service (and that won't be until tomorrow).
A good analogy to what I'm trying to do is to imagine a Database
Connection Pool as a windows service. When the machine starts up,
<i>n</iconnections are created and held as available. At some point,
an application needing database connectivity requests an available
connection from the connection pool, which will then provide one to the
application. Ideally, I'd like to avoid using remoting, as it involves
a lot of serialization (if I understand its behavior correctly), and
performance is critical.
Thanks in advance,
Rob