LifetimeServices::RenewOnCallTime Property

 

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

Namespace:   System.Runtime.Remoting.Lifetime
Assembly:  mscorlib (in mscorlib.dll)

public:
property TimeSpan RenewOnCallTime {
	static TimeSpan get();
	[SecurityCriticalAttribute]
	[SecurityPermissionAttribute(SecurityAction::Demand, Flags = SecurityPermissionFlag::RemotingConfiguration)]
	static void set(TimeSpan value);
}

Property Value

Type: System::TimeSpan

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

Exception Condition
SecurityException

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.

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

// 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 );

SecurityPermission

for configuration of the remoting infrastructure. Demand value: SecurityAction::Demand; Permission value: SecurityPermissionFlag::RemotingConfiguration

.NET Framework
Available since 1.1
Return to top
Show: