AuditLogLocation Enumeração

Definição

Especifica o local onde os registos de eventos relacionados com segurança são escritos.

public enum class AuditLogLocation
public enum AuditLogLocation
type AuditLogLocation = 
Public Enum AuditLogLocation
Herança
AuditLogLocation

Campos

Name Valor Description
Default 0

Especifica a localização por defeito, que é determinada pelo sistema operativo. Se for suportada a escrita no registo de segurança (como no Windows Vista e Windows Server 2003 e plataformas posteriores), a localização padrão do registo é o registo de segurança. Caso contrário (como no Windows XP SP2), a localização padrão do registo é o registo de aplicação.

Application 1

Especifica o registo de aplicações no registo de eventos.

Security 2

Especifica o registo de Segurança no registo de eventos. O thread que chama tem SeAuditPrivilege de ser capaz de escrever no registo de Segurança.

Exemplos

O exemplo seguinte define a ServiceSecurityAuditBehavior.AuditLogLocation propriedade para um dos AuditLogLocation valores:

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

Observações

Ao criar uma aplicação Windows Communication Foundation (WCF) que requer autenticação e/ou autorização dos chamadores, pode especificar que eventos relacionados com a segurança sejam registados para sucesso, falha ou ambos. A localização do tronco é determinada por esta enumeração.

O nível do registo de auditoria é especificado definindo a MessageAuthenticationAuditLevel ou a ServiceAuthorizationAuditLevel propriedade da ServiceSecurityAuditBehavior classe para um dos AuditLevel valores.

Também pode especificar o comportamento de auditoria usando a <ligação ServiceSecurityAudit> .

Importante

Se a AuditLogLocation propriedade estiver definida como Security e Audit Object Access não estiver definida no Local Security Policy, eventos de auditoria não serão escritos no registo de Segurança. Nenhuma falha é retornada, mas as entradas de auditoria não serão escritas no registo de Segurança. Além disso, o thread que chama tem SeAuditPrivilege de ser capaz de escrever no registo de Segurança.

Padrão Dependente do Sistema Operativo

Ao definir a propriedade para o valor Default, o sistema operativo determina em que log será realmente escrito. Para obter mais informações, veja Auditoria.

Aplica-se a

Ver também