Compartir a través de


HostProtectionAttribute.SelfAffectingProcessMgmt Propiedad

Definición

Obtiene o establece un valor que indica si la administración de procesos con efecto sobre sí mismos está expuesta.

public:
 property bool SelfAffectingProcessMgmt { bool get(); void set(bool value); };
public bool SelfAffectingProcessMgmt { get; set; }
member this.SelfAffectingProcessMgmt : bool with get, set
Public Property SelfAffectingProcessMgmt As Boolean

Valor de propiedad

Es true si la administración de procesos con efecto sobre sí mismos está expuesta a un riesgo; de lo contrario, es false. De manera predeterminada, es false.

Ejemplos

En el ejemplo de código siguiente se muestra el uso del HostProtectionAttribute atributo con la SelfAffectingProcessMgmt propiedad . Este ejemplo forma parte de un ejemplo más grande proporcionado para la HostProtectionAttribute clase .

// Use the enumeration flags to indicate that this method exposes shared state and 
// self-affecting process management.
// Either of the following attribute statements can be used to set the 
// resource flags.
// Exit the sample when an exception is thrown.

[HostProtection(SharedState=true,SelfAffectingProcessMgmt=true)]
[HostProtection(Resources=HostProtectionResource::SharedState|
HostProtectionResource::SelfAffectingProcessMgmt)]
static void Exit( String^ Message, int Code )
{
   Console::WriteLine( "\nFAILED: {0} {1}", Message, Code );
   Environment::ExitCode = Code;
   Environment::Exit( Code );
}
// Use the enumeration flags to indicate that this method exposes 
// shared state and self-affecting process management.
// Either of the following attribute statements can be used to set the
// resource flags.
[HostProtectionAttribute(SharedState = true, 
    SelfAffectingProcessMgmt = true)]
[HostProtectionAttribute(Resources = HostProtectionResource.SharedState |
     HostProtectionResource.SelfAffectingProcessMgmt)]
private static void Exit(string Message, int Code)
{
    // Exit the sample when an exception is thrown.
    Console.WriteLine("\nFAILED: " + Message + " " + Code.ToString());
    Environment.ExitCode = Code;
    Environment.Exit(Code);
}
' Use the enumeration flags to indicate that this method exposes 
' shared state and self-affecting process management.
' Either of the following attribute statements can be used to set the 
' resource flags.
<HostProtectionAttribute(SharedState := True, _
    SelfAffectingProcessMgmt := True), _
    HostProtectionAttribute( _
    Resources := HostProtectionResource.SharedState Or _
    HostProtectionResource.SelfAffectingProcessMgmt)> _
Private Shared Sub [Exit](ByVal Message As String, ByVal Code As Integer)

    ' Exit the sample when an exception is thrown.
    Console.WriteLine((ControlChars.Lf & "FAILED: " & Message & " " & _
        Code.ToString()))
    Environment.ExitCode = Code
    Environment.Exit(Code)
End Sub

Comentarios

El código de administración de procesos que afecta automáticamente podría salir del proceso actual, finalizando el servidor.

Se aplica a

Consulte también