all groups > dotnet remoting > august 2004 >
You're in the

dotnet remoting

group:

How to expose two different objects from single server via .NET Remoting?


How to expose two different objects from single server via .NET Remoting? orencs NO[at]SPAM nice.com
8/29/2004 11:28:24 PM
dotnet remoting:
How to expose two different objects via .NET Remoting?

Hello,

I am trying to do the following:
Exposing Obj1 and Obj2 via ProcessA
Conects to obj1 from Client1 and connect Obj2 from Client2
both Objects has events.

Obj1 is implemented in ProcessA
Obj2 is implemented in DLL.
The DLL is referencedin ProcessA

When I expose only one object the server starts well and the
corresponded client work with it great.

When I try to expose them both
The first Configure call , of obj2, succeeded:
RemotingConfiguration.Configure("LogManagerRemoting.config");

I receive the following exception in the second Configure call:
RemotingConfiguration.Configure ("nvAppServer.exe.config");

Ex:
{"Remoting configuration failed with the exception
System.Runtime.Remoting.RemotingException: The remoting application
name, ServerAssembly, had already been set.\r\n at
System.Runtime.Remoting.RemotingConfigHandler.set_ApplicationName(String
value)\r\n at System.Runtime.Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData
configData)." }


My configuration
Obj2
config file:
<system.runtime.remoting>
<application name="ServerAssembly" >
<customErrors mode="off"/>
<service>

<wellknown mode="Singleton"
type="NiceVision.Common.LogManager.LogManagerEventSharedObj,
LogManager" objectUri="LogManagerUID" />
</service>
<channels>
<channel ref="tcp" port="64545">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>


</channel>
</channels>

<lifetime leaseTime="3D" sponsorshipTimeout="1H"
renewOnCallTime="1D" leaseManagerPollTime="1H" />
</application>
</system.runtime.remoting>



obj1
Config file
<system.runtime.remoting>
<application name="nvAppServer" >
<customErrors mode="off"/>
<service>

<wellknown mode="Singleton"
type="NiceVision.ApplicationServer.ServiceInterfaces.ApplicationServerAPI,
nvAppServer" objectUri="ApplicationServer" />
</service>
<channels>
<channel ref="tcp" port="65100">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>

<lifetime leaseTime="3D" sponsorshipTimeout="1H"
renewOnCallTime="1D" leaseManagerPollTime="1H" />
</application>
Re: How to expose two different objects from single server via .NET Remoting? Ken Kolda
8/30/2004 9:42:21 AM
What you're trying to do won't work without creating a second AppDomain.In a
single AppDomain, every remoted object is exposed through every remoting
channel registered in that domain. Thus, if you create two TCP channels on
two different ports, you cannot specify that Object A should be attached to
Port #1 and Object B attached to Port #2.

So, you should either merge your config files into a single file or create
two AppDomains and have each read its own config file separately.

Ken


[quoted text, click to view]
System.Runtime.Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlC
onfigFileData
[quoted text, click to view]

AddThis Social Bookmark Button