AuditLogLocation Enum

Definitie

Hiermee geeft u de locatie op waar beveiligingsgerelateerde gebeurtenislogboeken worden geschreven.

public enum class AuditLogLocation
public enum AuditLogLocation
type AuditLogLocation = 
Public Enum AuditLogLocation
Overname
AuditLogLocation

Velden

Name Waarde Description
Default 0

Hiermee geeft u de standaardlocatie, die wordt bepaald door het besturingssysteem. Als schrijven naar het beveiligingslogboek wordt ondersteund (zoals op Windows Vista- en Windows Server 2003- en hogerplatforms), is de standaardlogboeklocatie het beveiligingslogboek. Anders (zoals in Windows XP SP2), is de standaardlogboeklocatie het toepassingslogboek.

Application 1

Hiermee geeft u het toepassingslogboek in het gebeurtenislogboek.

Security 2

Hiermee geeft u het beveiligingslogboek in het gebeurtenislogboek. De aanroepende thread moet SeAuditPrivilege kunnen schrijven naar het beveiligingslogboek.

Voorbeelden

In het volgende voorbeeld wordt de ServiceSecurityAuditBehavior.AuditLogLocation eigenschap ingesteld op een van de AuditLogLocation waarden:

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

Opmerkingen

Wanneer u een WCF-toepassing (Windows Communication Foundation) maakt waarvoor verificatie en/of autorisatie van bellers is vereist, kunt u opgeven dat gebeurtenissen met betrekking tot beveiliging worden vastgelegd voor geslaagde, mislukte of beide. De locatie van het logboek wordt bepaald door deze opsomming.

Het niveau van het auditlogboek wordt opgegeven door de MessageAuthenticationAuditLevel of de ServiceAuthorizationAuditLevel eigenschap van de ServiceSecurityAuditBehavior klasse in te stellen op een van de AuditLevel waarden.

U kunt ook auditgedrag opgeven met behulp van de <serviceSecurityAudit-binding> .

Important

Als de AuditLogLocation eigenschap is ingesteld op Beveiliging en Audit Object Access niet is ingesteld in de Local Security Policyeigenschap, worden controlegebeurtenissen niet naar het beveiligingslogboek geschreven. Er wordt geen fout geretourneerd, maar controlevermeldingen worden niet naar het beveiligingslogboek geschreven. Bovendien moet SeAuditPrivilege de aanroepende thread kunnen schrijven naar het beveiligingslogboek.

Standaard afhankelijk van het besturingssysteem

Wanneer u de eigenschap instelt op de standaardwaarde, bepaalt het besturingssysteem naar welk logboek daadwerkelijk wordt geschreven. Zie Controle voor meer informatie.

Van toepassing op

Zie ook