[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

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

orencs

8/30/2004 6:28:00 AM

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>
</system.runtime.remoting>
1 Answer

retoro

8/30/2004 4:42:00 PM

0

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


"oren" <orencs@nice.com> wrote in message
news:593d37f4.0408292228.7d03c1b1@posting.google.com...
> 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(RemotingXmlC
onfigFileData
> 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>
> </system.runtime.remoting>