RemotingConfiguration.IsActivationAllowed 方法

返回一个布尔值,该值指示是否允许由客户端激活指定的 Type

**命名空间:**System.Runtime.Remoting
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public Shared Function IsActivationAllowed ( _
    svrType As Type _
) As Boolean
用法
Dim svrType As Type
Dim returnValue As Boolean

returnValue = RemotingConfiguration.IsActivationAllowed(svrType)
public static bool IsActivationAllowed (
    Type svrType
)
public:
static bool IsActivationAllowed (
    Type^ svrType
)
public static boolean IsActivationAllowed (
    Type svrType
)
public static function IsActivationAllowed (
    svrType : Type
) : boolean

参数

  • svrType
    要检查的对象 Type

返回值

如果允许由客户端激活指定的 Type,则为 true;否则为 false

异常

异常类型 条件

SecurityException

在调用堆栈上部,至少有一个调用方没有配置远程处理类型和通道的权限。

备注

当前方法用于服务器端以确定服务器是否显式允许对象 Type 的激活。

示例

' 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
// 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( 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(MyServerImpl.
    class.ToType())) {
    // Get the registered activated service types .
    ActivatedServiceTypeEntry myActivatedServiceEntries[] = 
        RemotingConfiguration.GetRegisteredActivatedServiceTypes();
    Console.WriteLine("The Length of the registered activated service"
        + " type array is " + myActivatedServiceEntries.get_Length());
    Console.WriteLine("The Object type is:"
        + myActivatedServiceEntries[0].get_ObjectType());
}

.NET Framework 安全性

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

RemotingConfiguration 类
RemotingConfiguration 成员
System.Runtime.Remoting 命名空间