Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Remoting Problem: How to unregister a WellKnownClientType?

Remoting Problem: How to unregister a WellKnownClientType?

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    occcy
    wrote on last edited by
    #1

    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?

    H 1 Reply Last reply
    0
    • O occcy

      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?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      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 static Disconnect method. If you don't have an instance of it available, you can get one using other methods of the RemotingServices 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-----

      O 1 Reply Last reply
      0
      • H Heath Stewart

        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 static Disconnect method. If you don't have an instance of it available, you can get one using other methods of the RemotingServices 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-----

        O Offline
        O Offline
        occcy
        wrote on last edited by
        #3

        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 (with RegisterWellKnownClient) 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!

        O 1 Reply Last reply
        0
        • O occcy

          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 (with RegisterWellKnownClient) 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!

          O Offline
          O Offline
          occcy
          wrote on last edited by
          #4

          I found a solution for this problem by myself! My Server marshals the Serverobject (RemotingServices.Marshal) and my Client connects that object (RemotingServices.Connect).

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups