AuditLogLocation AuditLogLocation AuditLogLocation AuditLogLocation Enum

Definición

Especifica la ubicación donde se escriben los registros de eventos relacionados con la seguridad.Specifies the location where security-related event logs are written.

public enum class AuditLogLocation
public enum AuditLogLocation
type AuditLogLocation = 
Public Enum AuditLogLocation
Herencia
AuditLogLocationAuditLogLocationAuditLogLocationAuditLogLocation

Campos

Application Application Application Application 1

Especifica el registro de aplicaciones en el registro de eventos.Specifies the Application log in the event log.

Default Default Default Default 0

Especifica la ubicación predeterminada, que viene determinada por el sistema operativo.Specifies the default location, which is determined by the operating system. Si se admite la escritura en el registro de seguridad (como en Windows VistaWindows Vista, Windows Server 2003Windows Server 2003 y plataformas posteriores), la ubicación del registro predeterminada será el registro de seguridad.If writing to the Security log is supported (such as on Windows VistaWindows Vista and Windows Server 2003Windows Server 2003 and later platforms), the default log location is the Security log. De lo contrario (como en Windows XP SP2Windows XP SP2), la ubicación del registro predeterminada será el registro de aplicaciones.Otherwise (such as in Windows XP SP2Windows XP SP2), the default log location is the Application log.

Security Security Security Security 2

Especifica el registro de seguridad en el registro de eventos.Specifies the Security log in the event log. El subproceso de la llamada debe contar con SeAuditPrivilege para poder escribir en el registro de seguridad.The calling thread must have SeAuditPrivilege to be able to write to the Security log.

Ejemplos

En el ejemplo siguiente se ServiceSecurityAuditBehavior.AuditLogLocation establece la propiedad en uno AuditLogLocation de los valores de:The following example sets the ServiceSecurityAuditBehavior.AuditLogLocation property to one of the AuditLogLocation values:

public static void Main()
{
    // Get base address from appsettings in configuration.
    Uri baseAddress = new Uri(ConfigurationManager.
        AppSettings["baseAddress"]);

    // Create a ServiceHost for the CalculatorService type 
    // and provide the base address.
    using (ServiceHost serviceHost = new 
        ServiceHost(typeof(CalculatorService), baseAddress))
    {
        // Create a new auditing behavior and set the log location.
        ServiceSecurityAuditBehavior newAudit = 
            new ServiceSecurityAuditBehavior();
        newAudit.AuditLogLocation = 
            AuditLogLocation.Application;
        newAudit.MessageAuthenticationAuditLevel = 
            AuditLevel.SuccessOrFailure;
        newAudit.ServiceAuthorizationAuditLevel = 
            AuditLevel.SuccessOrFailure;
        newAudit.SuppressAuditFailure = false;
        // Remove the old behavior and add the new.
        serviceHost.Description.
            Behaviors.Remove<ServiceSecurityAuditBehavior>();
        serviceHost.Description.Behaviors.Add(newAudit);
        // Open the ServiceHostBase to create listeners 
        // and start listening for messages.
        serviceHost.Open();

        // The service can now be accessed.
        Console.WriteLine("The service is ready.");
        Console.WriteLine("Press <ENTER> to terminate service.");
        Console.WriteLine();
        Console.ReadLine();

        // Close the ServiceHostBase to shutdown the service.
        serviceHost.Close();
    }
}
Public Shared Sub Main() 
    ' Get base address from appsettings in configuration.
    Dim baseAddress As New Uri(ConfigurationManager.AppSettings("baseAddress"))
    
    ' Create a ServiceHost for the CalculatorService type 
    ' and provide the base address.
    Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
    Try
        ' Create a new auditing behavior and set the log location.
        Dim newAudit As New ServiceSecurityAuditBehavior()
        newAudit.AuditLogLocation = AuditLogLocation.Application
        newAudit.MessageAuthenticationAuditLevel = _
            AuditLevel.SuccessOrFailure
        newAudit.ServiceAuthorizationAuditLevel = _
            AuditLevel.SuccessOrFailure
        newAudit.SuppressAuditFailure = False
        ' Remove the old behavior and add the new.
        serviceHost.Description.Behaviors.Remove(Of ServiceSecurityAuditBehavior)
        serviceHost.Description.Behaviors.Add(newAudit)
        ' Open the ServiceHostBase to create listeners 
        ' and start listening for messages.
        serviceHost.Open()
        
        ' The service can now be accessed.
        Console.WriteLine("The service is ready.")
        Console.WriteLine("Press <ENTER> to terminate service.")
        Console.WriteLine()
        Console.ReadLine()
        
        ' Close the ServiceHostBase to shutdown the service.
        serviceHost.Close()
    Finally
    End Try

End Sub 

Comentarios

Al crear una aplicación de Windows Communication Foundation (WCF) que requiera autenticación y/o autorización de autores de llamadas, puede especificar que los eventos relacionados con la seguridad se registren con éxito, error o ambos.When creating a Windows Communication Foundation (WCF) application that requires authentication and/or authorization of callers, you can specify that events related to security be recorded for either success, failure, or both. Esta enumeración determina la ubicación del registro.The location of the log is determined by this enumeration.

El nivel del registro de auditoría se especifica estableciendo la propiedad MessageAuthenticationAuditLevel o ServiceAuthorizationAuditLevel de la clase ServiceSecurityAuditBehavior en uno de los valores de AuditLevel.The level of the audit log is specified by setting the MessageAuthenticationAuditLevel or the ServiceAuthorizationAuditLevel property of the ServiceSecurityAuditBehavior class to one of the AuditLevel values.

También puede especificar el comportamiento de auditoría mediante <el> enlace serviceSecurityAudit .You can also specify audit behavior using the <serviceSecurityAudit> binding.

Importante

Si la AuditLogLocation propiedad se establece en seguridad y Audit Object Access no Local Security Policyse establece en, los eventos de auditoría no se escribirán en el registro de seguridad.If the AuditLogLocation property is set to Security and Audit Object Access is not set in the Local Security Policy, audit events will not be written to the Security log. No se devuelve ningún error aunque las entradas de auditoría no se escribirán en el registro de seguridad.No failure is returned, but audit entries will not be written to the Security log. Además, el subproceso de la llamada debe contar con SeAuditPrivilege para poder escribir en el registro de seguridad.In addition, the calling thread must have SeAuditPrivilege to be able to write to the Security log.

Dependiente predeterminado en el sistema operativoDefault Dependent on Operating System

Al establecer la propiedad en el valor predeterminado, el sistema operativo determina en qué registro se escribirá realmente.When setting the property to the Default value, the operating system determines which log will actually be written to. Para obtener más información, consulte Auditoría.For more information, see Auditing.

Se aplica a

Consulte también: