LifetimeServices.RenewOnCallTime LifetimeServices.RenewOnCallTime LifetimeServices.RenewOnCallTime LifetimeServices.RenewOnCallTime Property

Definición

Obtiene o establece el tiempo en que se amplía la concesión cada que vez que se recibe una llamada en el objeto de servidor.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 property TimeSpan RenewOnCallTime { TimeSpan get(); void set(TimeSpan value); };
[set: System.Security.SecurityCritical]
public static TimeSpan RenewOnCallTime { get; set; }
member this.RenewOnCallTime : TimeSpan with get, set
Public Shared Property RenewOnCallTime As TimeSpan

Valor de propiedad

TimeSpan en que se amplía una concesión de período de duración en el AppDomain actual después de cada llamada.The TimeSpan by which a lifetime lease in the current AppDomain is extended after each call.

Excepciones

Al menos uno de los llamadores situados en la parte superior de la pila de llamadas no tiene permiso para configurar los tipos y canales de comunicación remota.At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. Esta excepción se produce únicamente cuando se establece el valor de propiedad.This exception is thrown only when setting the property value.

Ejemplos

// Register the channel.
TcpChannel^ myChannel = gcnew TcpChannel;
ChannelServices::RegisterChannel( myChannel );
RemotingConfiguration::RegisterActivatedClientType( HelloService::typeid, "Tcp://localhost:8085" );
TimeSpan myTimeSpan = TimeSpan::FromMinutes( 10 );

// Create a remote object.
HelloService ^ myService = gcnew HelloService;
ILease^ myLease;
myLease = dynamic_cast<ILease^>(RemotingServices::GetLifetimeService( myService ));
if ( myLease == nullptr )
{
   Console::WriteLine( "Cannot lease." );
   return  -1;
}

Console::WriteLine( "Initial lease time is {0}", myLease->InitialLeaseTime );
Console::WriteLine( "Current lease time is {0}", myLease->CurrentLeaseTime );
Console::WriteLine( "Renew on call time is {0}", myLease->RenewOnCallTime );
Console::WriteLine( "Sponsorship timeout is {0}", myLease->SponsorshipTimeout );
Console::WriteLine( "Current lease state is {0}", myLease->CurrentState );
// 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());
' Register the channel.
Dim myChannel As New TcpChannel()
ChannelServices.RegisterChannel(myChannel)
RemotingConfiguration.RegisterActivatedClientType( _
                  GetType(HelloService), "Tcp://localhost:8085")

Dim myTimeSpan As TimeSpan = TimeSpan.FromMinutes(10)

' Create a remote object.
Dim myService As New HelloService()

Dim myLease As ILease
myLease = CType(RemotingServices.GetLifetimeService(myService), ILease)
If myLease Is Nothing Then
   Console.WriteLine("Cannot lease.")
   Return
End If

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

Comentarios

El tiempo de renovación predeterminado por el que se amplía una concesión de duración es de 2 minutos.The default renewal time by which a lifetime lease is extended is 2 minutes.

Seguridad

SecurityPermission
para la configuración de la infraestructura de comunicación remota.for configuration of the remoting infrastructure. Valor de petición Demand:; Valor de permiso:RemotingConfigurationDemand value: Demand; Permission value: RemotingConfiguration

Se aplica a