aginfo

aginfo

  • NA
  • 1
  • 0

Singleton Infinite LifeTime sets does not work! Why?

Mar 18 2006 5:38 AM

I thy to change lifetime mode of ordinary registered singleton to "live forever".

Try this:
----------------
public override object InitializeLifetimeService()
{ ILease lease = (ILease)base.InitializeLifetimeService();
 if (lease.CurrentState == LeaseState.Initial)
 { lease.InitialLeaseTime = TimeSpan.Zero; }
 return lease; }  
---------------- 

Or Try this (as reccommended):
----------------
public override object InitializeLifetimeService()
{ return null; }  
----------------

But in both cases singleton die after 5 min.

When I try to get it's method I get just this exception:
----------------
System.Runtime.Remoting.RemotingException: Object </a674b2d5_aaa9_4d81_9cea_711fedd477ee/EvOYTfALsdx5x0kAnJOlt5OY_9.rem> has been disconnected or does not exist at the server.
Server stack trace: 
at System.Runtime.Remoting.Channels.ChannelServices.CheckDisconnectedOrCreateWellKnownObject(IMessage msg)
at System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage msg)Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
----------------

That means that overriding of InitializeLifetimeService() has no effects!
How can it be possible?

Thanks a lot for any help.