RemotingServices.Marshal allows you to publish an existing instance remotely. Both for server activated (wellknown) and client activated objects remoting controls when the object is instantiated and initialized. Using Marshal allows you to initialize the object before making it available remotely. The published object will still follow the same lifetime rules, meaning it will be disconnected when the lease on it expires.

Do disconnect an object published to remoting use RemotingServices.Disconnect (not RemotingServices.Unmarshal). Unmarshal is mostly a client side function to create a transparent proxy from an ObjRef.

Comments (2)

  1. Reluctant Remoting Programmer says:

    Thats all nice. However what I have seen is that if I have a SAO that is published via RemotingServices.Marshal and then I disconnect it with RemotingServices.Disconnect if a client makes another call using the old reference a new SAO is created by the server. If you don’t want this because a) You wanted to specifiaclly initialize the object b) You don’t have a default constructor then you are nuked. Even unregistering the channel does’nt seem to prevent a client who already has a reference.

    I have been working with remoting a bit in the last few days and have run into brick walls that are painful.

  2. ManishG says:

    Maybe I am missing something here, but if you use RemotingServices.Marshal, you dont have to register the object as a SAO(wellknown). Offcourse, a server channel needs to be registered, but that should be it.


Skip to main content