Freigeben über


<lifetime> Element 

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 MarshalByRefObject.InitializeLifetimeService on your remote type.

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

Attributes and Elements

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.

Remarks

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".

Example

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"
/>

See Also

Reference

Remoting Settings Schema
MarshalByRefObject.InitializeLifetimeService

Concepts

Activation of Remote Objects