AuditLevel 열거형

정의

보안 이벤트를 감사할 시기를 지정합니다.

public enum class AuditLevel
public enum AuditLevel
type AuditLevel = 
Public Enum AuditLevel
상속
AuditLevel

필드

Failure 2

실패한 보안 관련 이벤트만 기록됩니다.

None 0

이벤트가 기록되지 않습니다. 이것이 기본값입니다.

Success 1

성공한 보안 관련 이벤트만 기록됩니다.

SuccessOrFailure 3

실패한 보안 관련 이벤트와 성공한 보안 관련 이벤트가 모두 기록됩니다.

예제

다음 예제에서는 MessageAuthenticationAuditLevelServiceAuthorizationAuditLevel 속성을 AuditLevel 값 중 하나로 설정합니다.

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

설명

인증 및/또는 호출자의 권한 부여를 요구 하는 Windows Communication Foundation (WCF) 애플리케이션을 만들 때 성공, 실패 또는 둘 다에 대 한 보안 관련 이벤트가 기록 되도록 지정할 수 있습니다. 감사의 수준은 이 열거형에 의해 결정됩니다.

감사 로그의 위치는 AuditLogLocation 클래스의 ServiceSecurityAuditBehavior 속성을 AuditLogLocation 값 중 하나로 설정하여 지정합니다.

감사에 대 한 자세한 내용은 참조 하세요. 감사합니다.

serviceSecurityAudit 바인딩을 사용하여 감사 동작을 <지정할 수도 있습니다.>

적용 대상

추가 정보