Export (0) Print
Expand All

<lifetime> Element

This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the  Windows Communication Foundation (WCF).

Contains information about the lifetime of all client-activated objects serviced by this application. Specific lifetime control for individual objects can be set by overriding System.MarshalByRefObject.InitializeLifetimeService on your remote type. This element may occur in an application configuration file, machine configuration file.


<lifetime  
   leaseTime="leasetime"
   sponsorshipTimeout="sponsorshipTimeOut"
   renewOnCallTime="renewOnCallTime"
      leaseManagerPollTime="pollTime" 
/>

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

leaseTime

Optional attribute.

Specifies the lease time for the application. The default leaseTime is 5 minutes.

sponsorshipTimeout

Optional attribute.

Specifies the time the lease manager waits for the sponsor to respond when notified that a lease has expired. If the sponsor does not respond in the specified time, the garbage collector disposes of the remote object. The default sponsorshipTimeout is 2 minutes.

renewOnCallTime

Optional attribute.

Specifies the amount of time that the lease time is extended with every function call on the object. The default renewOnCallTime is 2 minutes.

leaseManagerPollTime

Optional attribute.

Specifies the amount of time the lease manager sleeps after checking for expired leases. The default leaseManagerPollTime is 10 seconds.

Child Elements

None.

Parent Elements

Element Description

application

Contains information about remote objects the application consumes and exposes.

configuration

The root element in every configuration file used by the common language runtime and .NET Framework applications.

system.runtime.remoting

Contains information about remote objects and channels.

The <lifetime> element has four optional attributes. Valid values for each are a decimal and a time unit. Valid time units are D for days, H for hours, M for minutes, S for seconds, and MS for milliseconds. If no unit is specified, the default time unit is seconds. For example, "10" is interpreted as "10S".

The following example sets all client-activated objects to a 5-minute lease time, a sponsorship time-out of 2 minutes, a renewal of 2 more minutes each time a method is called, and a lease manager poll time of 10 seconds.

<lifetime 
   leaseTime="5M" 
   sponsorshipTimeOut="2M" 
   renewOnCallTime="2M" 
   leaseManagerPollTime="10S"
/>



Copyright © 2007 by Microsoft Corporation. All rights reserved.

Community Additions

Show:
© 2014 Microsoft