RemotingConfiguration.IsActivationAllowed(Type) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个布尔值,该值指示是否允许由客户端激活指定的 Type。
public:
static bool IsActivationAllowed(Type ^ svrType);
public static bool IsActivationAllowed (Type svrType);
static member IsActivationAllowed : Type -> bool
Public Shared Function IsActivationAllowed (svrType As Type) As Boolean
参数
返回
如果允许由客户端激活指定的 Type,则为 true
;否则为 false
。
例外
在调用堆栈上部,至少有一个调用方没有配置远程处理类型和通道的权限。
示例
// Check whether the 'MyServerImpl' object is allowed for
// activation or not.
if ( RemotingConfiguration::IsActivationAllowed( MyServerImpl::typeid ) )
{
// Get the registered activated service types .
array<ActivatedServiceTypeEntry^>^myActivatedServiceEntries = RemotingConfiguration::GetRegisteredActivatedServiceTypes();
Console::WriteLine( "The Length of the registered activated service type array is {0}", myActivatedServiceEntries->Length );
Console::WriteLine( "The Object type is:{0}", myActivatedServiceEntries[ 0 ]->ObjectType );
}
// Check whether the 'MyServerImpl' object is allowed for
// activation or not.
if(RemotingConfiguration.IsActivationAllowed(typeof(MyServerImpl)))
{
// Get the registered activated service types .
ActivatedServiceTypeEntry[] myActivatedServiceEntries =
RemotingConfiguration.GetRegisteredActivatedServiceTypes();
Console.WriteLine("The Length of the registered activated service"
+" type array is "+myActivatedServiceEntries.Length);
Console.WriteLine("The Object type is:"
+myActivatedServiceEntries[0].ObjectType);
}
' Check whether the 'MyServerImpl' object is allowed for activation or not.
If RemotingConfiguration.IsActivationAllowed(GetType(MyServerImpl)) Then
' Get the registered activated service types .
Dim myActivatedServiceEntries As ActivatedServiceTypeEntry() = _
RemotingConfiguration.GetRegisteredActivatedServiceTypes()
Console.WriteLine("The Length of the registered activated service type array is " + _
myActivatedServiceEntries.Length.ToString())
Console.WriteLine("The Object type is:" + _
myActivatedServiceEntries(0).ObjectType.ToString())
End If
注解
在服务器端使用当前方法来确定服务器是否显式允许激活对象 Type 。