I have done some testing and it appears that the framework does not call InitializeLifetimeService until just before returning the
object reference to the client.
I would like to use the ILease returned from InitializeLifetimeService in the server code before returning to the client. I have
observed that a call to GetLifetimeService returns a null, so I put code in to explicitly call InitializeLifetimeService on my
newly created object. I also put code in the override for InitializeLifetimeService to display when it was called and what the
state was. I received two displays both with the state of Initial. One from my explicit call and on from the framework as it was
returning to the client.
For this I would say that either
1) - I am totally messed up
or
2) - You just can't do this
I would appreciate any understanding about this issue and/or a suggestion of a way that I can acquire and use an ILease prior to
the return to the client.
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
http://www.kmsys.com
Roy Chastain - 27 May 2005 13:18 GMT
I have discovered that this is (at least one) reason that RemotingServices.Marshal exists. Calling it in the server code forces
InitializeLifetimeService to get called and that allows the lease information to be used on the server prior to that return.
>I have done some testing and it appears that the framework does not call InitializeLifetimeService until just before returning the
>object reference to the client.
[quoted text clipped - 16 lines]
>KMSYS Worldwide, Inc.
>http://www.kmsys.com
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
http://www.kmsys.com