Mango_mm
April 22nd, 2003, 10:01 PM
I am doing a server-client project using .NET remoting.
The server application are installed on 2 servers (exactly the same). I used "singleton" type on the remote object. When a client application starts, it uses the 1st server as primary and build a TCP channel with it.
The code is:
TcpChannel channel = new TcpChannel(port);
ChannelServices.RegisterChannel(channel);
WellKnownClientTypeEntry entry = new WellKnownClientTypeEntry(
typeof(myRemoteObj),
RmtObjUrl);
RemotingConfiguration.RegisterWellKnownClientType(entry);
Everything goes smoothly till now. But my design is, if the server goes down, client should be able to switch to the other server without closing and re-opening.
I used the same code to register the 2nd server, showing as blow:
WellKnownClientTypeEntry entry = new WellKnownClientTypeEntry(
typeof(myRemoteObj),
new_RmtObjUrl);
RemotingConfiguration.RegisterWellKnownClientType(entry);
The value of "new_RmtObjUrl" now is the 2nd server's location and port. The error occurs at :
RemotingConfiguration.RegisterWellKnownClientType(entry);
Error message is:
An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll
Additional information: Attempt to redirect activation of type 'myRemoteObj, myRemoteObj' which is already redirected.
How can i un-register the privous activation of "myRemoteObj"? Or is there anyway to build a new channel to the 2nd server?
Thanks in advance on your kindly follow up! I have been stick on it for the whole night :(
The server application are installed on 2 servers (exactly the same). I used "singleton" type on the remote object. When a client application starts, it uses the 1st server as primary and build a TCP channel with it.
The code is:
TcpChannel channel = new TcpChannel(port);
ChannelServices.RegisterChannel(channel);
WellKnownClientTypeEntry entry = new WellKnownClientTypeEntry(
typeof(myRemoteObj),
RmtObjUrl);
RemotingConfiguration.RegisterWellKnownClientType(entry);
Everything goes smoothly till now. But my design is, if the server goes down, client should be able to switch to the other server without closing and re-opening.
I used the same code to register the 2nd server, showing as blow:
WellKnownClientTypeEntry entry = new WellKnownClientTypeEntry(
typeof(myRemoteObj),
new_RmtObjUrl);
RemotingConfiguration.RegisterWellKnownClientType(entry);
The value of "new_RmtObjUrl" now is the 2nd server's location and port. The error occurs at :
RemotingConfiguration.RegisterWellKnownClientType(entry);
Error message is:
An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll
Additional information: Attempt to redirect activation of type 'myRemoteObj, myRemoteObj' which is already redirected.
How can i un-register the privous activation of "myRemoteObj"? Or is there anyway to build a new channel to the 2nd server?
Thanks in advance on your kindly follow up! I have been stick on it for the whole night :(