LifetimeServices.SponsorshipTimeout 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置租约管理器等待主办方返回租约续订时间的时间。
public:
static property TimeSpan SponsorshipTimeout { TimeSpan get(); void set(TimeSpan value); };
public static TimeSpan SponsorshipTimeout { get; set; }
public static TimeSpan SponsorshipTimeout { get; [System.Security.SecurityCritical] set; }
static member SponsorshipTimeout : TimeSpan with get, set
[<set: System.Security.SecurityCritical>]
static member SponsorshipTimeout : TimeSpan with get, set
Public Shared Property SponsorshipTimeout As TimeSpan
属性值
初始主办关系超时。
- 属性
例外
在调用堆栈上部,至少有一个调用方没有配置远程处理类型和通道的权限。 仅在设置该属性值时才会引发此异常。
示例
// 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())
注解
对发起人的呼叫超时前的默认时间为 2 分钟。