I have a number of remotable DLLs, which are hosted by a Windows Service. The Windows Service simply registers the remotable DLLs using RemotingConfiguration.Configure. The configuration file is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="UniConnect">
<service>
<wellknown mode="SingleCall" type="Northgate.HRS.UniConnect.UCRegistry, ZUCRegistry" objectUri="RegistryServer.rem"/>
<wellknown mode="SingleCall" type="Northgate.HRS.UniConnect.UCMailServer, ZUCMailServer" objectUri="MailServer.rem"/>
<wellknown mode="SingleCall" type="Northgate.HRS.UniConnect.UCDatabase, ZUCDatabase" objectUri="DatabaseServer.rem"/>
<activated type="Northgate.HRS.UniConnect.UCHostServer, ZUCHostServer"/>
</service>
<channels>
<channel ref="tcp" port="1608">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
I have a client application, which at start up, registers the remotable objects using RemotingConfiguration.Configure. The configuration file is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client url="tcp://localhost:1608/UniConnect">
<wellknown type="Northgate.HRS.UniConnect.UCRegistry, ZUCRegistry" url="tcp://localhost:1608/RegistryServer.rem"/>
<wellknown type="Northgate.HRS.UniConnect.UCMailServer, ZUCMailServer" url="tcp://localhost:1608/MailServer.rem"/>
<wellknown type="Northgate.HRS.UniConnect.UCDatabase, ZUCDatabase" url="tcp://localhost:1608/DatabaseServer.rem"/>
<activated type="Northgate.HRS.UniConnect.UCHostServer, ZUCHostServer" url="tcp://localhost:1608/UniConnect"/>
</client>
<channels>
<channel ref="tcp" port="0">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
Everything appears to work OK for the SAOs, but the CAO only ever gets instantiated once.
I start two copies of the client application, and both get the same CAO object. I can see this because I write information out to a log file.
If I remove the CAO from remoting altogether, everything is fine; I get a different object for each client.
Unfortunately, this object MUST be a CAO, as I need separate state information for each client.
I currently have no interfaces involved, and use New to instantiate the object.
I have tried using interfaces and a factory. I have tried using soapsuds. I have tried registering the CAO on the client side in the code, rather than using the configuration file. All to no avail; the CAO always acts like a Singleton SAO, when remoting is involved.
I imagine that I am doing something incredibly stupid, but I have now spent about 8 days trying out various methods, with no success.
Please help.
This is all running on my XP box, but I have remoted to another PC successfully, albeit that the CAO acts the same.
The remotable objects, the Windows Service and the Client are all written in VB.NET.