Remoting Problem: How to unregister a WellKnownClientType?
-
Hi! I use
RemotingConfiguration.RegisterWellKnownClientType(typeof(_type_),_url_)
to register a type as a wellknown client type. Is it possible to unregister this type to register it again with another url (or to change the url for the registered type) without restarting my application? -
Hi! I use
RemotingConfiguration.RegisterWellKnownClientType(typeof(_type_),_url_)
to register a type as a wellknown client type. Is it possible to unregister this type to register it again with another url (or to change the url for the registered type) without restarting my application?First, let me advocate that a well-known client Type can't be well-known if you change its URI. That being said, you can use
RemotingServices.Disconnect
. If you have a reference to the registered object, just pass it to the staticDisconnect
method. If you don't have an instance of it available, you can get one using other methods of theRemotingServices
class. Registering it with another URI is as simple as what you've already done. Another way is to simply shut down the .NET Remoting host, such as a Windows Service, IIS, or some other program, but that's most likely not what you want in this case.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
First, let me advocate that a well-known client Type can't be well-known if you change its URI. That being said, you can use
RemotingServices.Disconnect
. If you have a reference to the registered object, just pass it to the staticDisconnect
method. If you don't have an instance of it available, you can get one using other methods of theRemotingServices
class. Registering it with another URI is as simple as what you've already done. Another way is to simply shut down the .NET Remoting host, such as a Windows Service, IIS, or some other program, but that's most likely not what you want in this case.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
Hi! Thanks for your effort! Unfortunately doesn't work it... I want to explain the situation more detailed: When the client starts his application, he get's a login-dialog, where he has to type in the servername (and username, password ....) he wants to connect to. When the client types in a servername, that does not exist or the server is not available, he must get a new chance to login, without restarting his application. When he clicks the Login-Button I do something like this:
Dispather MyDispatcher; RemotingConfiguration.RegisterWellKnownClient(typeof(Dispatcher),URL); MyDispatcher=new Dispatcher(); MyDispatcher.Login(...); ...
If an error occures (severname incorrect or server not available) I have to unregister this Dispather-object first, before I can register it again with another URL.RemotingServices.Disconnect(Dispatcher)
does not work, because it's for Serverobjects. And Reregistering (withRegisterWellKnownClient
) throws an exception ("System.Runtime.Remoting.RemotingException: Es wurde versucht, die bereits umgeleitete Aktivierung des Typs 'Dispatcher, ccShared' erneut umzuleiten.").:doh: What can I do? Thanks in advance! -
Hi! Thanks for your effort! Unfortunately doesn't work it... I want to explain the situation more detailed: When the client starts his application, he get's a login-dialog, where he has to type in the servername (and username, password ....) he wants to connect to. When the client types in a servername, that does not exist or the server is not available, he must get a new chance to login, without restarting his application. When he clicks the Login-Button I do something like this:
Dispather MyDispatcher; RemotingConfiguration.RegisterWellKnownClient(typeof(Dispatcher),URL); MyDispatcher=new Dispatcher(); MyDispatcher.Login(...); ...
If an error occures (severname incorrect or server not available) I have to unregister this Dispather-object first, before I can register it again with another URL.RemotingServices.Disconnect(Dispatcher)
does not work, because it's for Serverobjects. And Reregistering (withRegisterWellKnownClient
) throws an exception ("System.Runtime.Remoting.RemotingException: Es wurde versucht, die bereits umgeleitete Aktivierung des Typs 'Dispatcher, ccShared' erneut umzuleiten.").:doh: What can I do? Thanks in advance!