Thanks so much!!! marhal(0 was just what I needed.
I want to control lifetime at the server's discretion - not the object. So
I tried GetLifetime...() after Marshal() but that gave me a "null" value.
When is InitializeLifetime.. called? Because I was thinkng I might have
object prior to calling Marshal. Then, I could set those timing properties
set variables.
"Dan Jacques" wrote:
> I'm relatively new to remoting myself, but I believe I can answer your
> questions:
>
> > Question #1)
> > After RegisterWellKnownServiceType instantiates my RemoteObj, how can my
> > server app now access this object to call a function directly. Must it act
> > like any other client and call Activator.GetObject?
>
> I originally did just that in my application. Dissatisfied, I performed
> some research and ended up using the RemotingServices.Marshal static
> function. On your remoting server application, the following code should
> work:
>
> RemotingObj remObj = new RemotingObj(args [you can put args in!]);
> ObjRef ref = RemotingServices.Marshal(remObj, "URI",
> typeof(RemotingInterface));
>
> I was lead to believe from a dotnet247 posting that this resulted in
> treatment equivalent to the RegisterWellKnownServiceType call with Singleton
> behavior. From this point on, you have remObj, a reference to your remoted
> object, on the server!
>
> Here's the post on the subject:
>
http://www.dotnet247.com/247reference/msgs/35/179183.aspx >
> My own experiences seem to support this. Furthermore, you can use the 'ref'
> ObjRef created from the Marhsl call to STOP remoting of that object
> (something I haven't as of yet been able to successfully do with the
> RegisterWellKnownServiceType command) using the RemotingServices.Unmarshal
> and RemotingServices.Disconnect commands on the server.
>
> > Question #2)
> >
> > Where would I change the lease timings on this object?
>
> The MarshalByRefObject class from which all Well-known objects must derive
> has an overrideable function called InitializeLifetimeService documented here:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmarshalbyrefobjectclassinitializelifetimeservicetopic.asp
>
> You just have to override this method in your remoted object and have it