LifetimeServices.RenewOnCallTime Property

Definition

Gets or sets the amount of time by which the lease is extended every time a call comes in on the server object.

public static TimeSpan RenewOnCallTime { get; set; }
public static TimeSpan RenewOnCallTime { get; [System.Security.SecurityCritical] set; }

Property Value

The TimeSpan by which a lifetime lease in the current AppDomain is extended after each call.

Attributes

Exceptions

At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. This exception is thrown only when setting the property value.

Examples

// Register the channel.
TcpChannel myChannel = new TcpChannel ();
ChannelServices.RegisterChannel(myChannel);
RemotingConfiguration.RegisterActivatedClientType(
                       typeof(HelloService),"Tcp://localhost:8085");

TimeSpan myTimeSpan = TimeSpan.FromMinutes(10);

// Create a remote object.
HelloService myService = new HelloService();

ILease myLease;
myLease = (ILease)RemotingServices.GetLifetimeService(myService);
if (myLease == null)
{
   Console.WriteLine("Cannot lease.");
   return;
}

Console.WriteLine ("Initial lease time is " + myLease.InitialLeaseTime);
Console.WriteLine ("Current lease time is " + myLease.CurrentLeaseTime);
Console.WriteLine ("Renew on call time is " + myLease.RenewOnCallTime);
Console.WriteLine ("Sponsorship timeout is " + myLease.SponsorshipTimeout);
Console.WriteLine ("Current lease state is " + myLease.CurrentState.ToString());

Remarks

The default renewal time by which a lifetime lease is extended is 2 minutes.

Applies to

제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1