Windows Service as Remoting Host: Requested Service Not Found

F

Fadi

Backround:
I am trying to figure out how to do the equivalant of a classic COM
Local Server Singleton in .NET/C#. I created a coupld of simple Class
Libs that exposes public interfaces and hosted them in a Windows Forms
EXE. Create a Windows Forms client and both the Client and the Host
EXEs configure the remoting protocols through respective .config
files.

Problem:
I want to change the host from an Win Forms EXE to a Windows Service.
The Windows Service is build and installed and I can start it
successfully but i am unable to communicate with the objects it hosts!
I get the error: "Requested Service Not Found".

I override InitializeLifetimeService() in both hosted objects to
return 'null' so the lease never expires, but w/o success in resolving
this error.

Thanks in advance...


Client.exe.Config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="MyComponents.LaserDoorServer, LaserDoor"
mode="Singleton" url="tcp://localhost:8005/LaserDoorServer" />
</client>

<client>
<wellknown type="MyComponents.LaserShutterServer, LaserShutter"
mode="Singleton" url="tcp://localhost:8005/LaserShutterServer" />
</client>
<channels>
<channel ref="tcp" />
</channels>
</application>
</system.runtime.remoting>
</configuration>


The HostService.exe.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<service>
<activated type="MyComponents.LaserDoorServer, LaserDoor" />
<wellknown type="MyComponents.LaserDoorServer, LaserDoor"
mode="Singleton" objectUri="LaserDoorServer" />
</service>

<service>
<activated type="MyComponents.LaserShutterServer, LaserShutter" />
<wellknown type="MyComponents.LaserShutter, LaserShutter"
mode="Singleton" objectUri="LaserShutterServer" />
</service>

<channels>
<channel ref="tcp" port="8005" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
 
S

Steve Lutz

Fadi,

In the Windows Service, where are you creating the remote object? How about
code snippets of the service.
 
F

Fadi

Hi Steve,

Thanks for the reply. The Windows Service (ComponentsService.exe)
simply calls:

protected override void OnStart(string[] args)
{
string remConfig =
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase +
"ComponentsService.exe.config";
RemotingConfiguration.Configure(remConfig);
}

The client app simply uses 'new' to create and comm with the remoted
objects.

Note that this works perfectly the the Host is a Win Forms EXE (which
i have to deliberately launch before the remote objects it hosts can
be accessed by the client)

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top