AuditLogLocation Enum
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Anger den plats där säkerhetsrelaterade händelseloggar skrivs.
public enum class AuditLogLocation
public enum AuditLogLocation
type AuditLogLocation =
Public Enum AuditLogLocation
- Arv
Fält
| Name | Värde | Description |
|---|---|---|
| Default | 0 | Anger standardplatsen, som bestäms av operativsystemet. Om skrivning till säkerhetsloggen stöds (till exempel på Windows Vista och Windows Server plattformar 2003 och senare) är standardloggplatsen säkerhetsloggen. Annars (till exempel i Windows XP SP2) är standardloggplatsen programloggen. |
| Application | 1 | Anger programloggen i händelseloggen. |
| Security | 2 | Anger säkerhetsloggen i händelseloggen. Den anropande tråden måste |
Exempel
I följande exempel anges egenskapen ServiceSecurityAuditBehavior.AuditLogLocation till ett av AuditLogLocation värdena:
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
Kommentarer
När du skapar ett Windows Communication Foundation-program (WCF) som kräver autentisering och/eller auktorisering av anropare, kan du ange att händelser som är relaterade till säkerhet registreras för antingen lyckade, misslyckade eller båda. Loggens plats bestäms av den här uppräkningen.
Granskningsloggens nivå anges genom att ange MessageAuthenticationAuditLevel egenskapen eller ServiceAuthorizationAuditLevel egenskapen ServiceSecurityAuditBehavior för klassen till ett av AuditLevel värdena.
Du kan också ange granskningsbeteende med hjälp av bindningen< serviceSecurityAudit>.
Important
Om egenskapen AuditLogLocation är inställd på Säkerhet och Audit Object Access inte anges i Local Security Policyskrivs inte granskningshändelserna till säkerhetsloggen. Inget fel returneras, men granskningsposter skrivs inte till säkerhetsloggen. Dessutom måste den anropande tråden kunna SeAuditPrivilege skriva till säkerhetsloggen.
Standardberoende av operativsystem
När du anger egenskapen till standardvärdet avgör operativsystemet vilken logg som faktiskt ska skrivas till. Mer information finns i Granskning.