如何使用auditLogLocation =“Security”在WCF服务中启用安全日志记录

时间:2013-12-27 09:26:48

标签: c# .net wcf security wcf-security

我正在研究WCF日志记录模块。我想使用WCF服务启用所有安全日志记录。就像auditLogLocation="Application | Security | Default中有三个选项一样。我使用了Application,但我想启用Security选项。我读了这个链接Auditing Security Events

我想了解如何在WCF服务中启用SeAuditPrivilegeSeSecurityPrivilege

  

这是我的配置

<behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="true" serviceAuthorizationAuditLevel="SuccessOrFailure"
            messageAuthenticationAuditLevel="SuccessOrFailure" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

1 个答案:

答案 0 :(得分:0)

您应该能够配置WCF安全审核,通过在配置文件中指定以下内容将安全事件记录到Windows事件日志中:

服务行为定义:(例如)

<behaviors>
   <behavior name="myAuditBehavior">
      <serviceSecurityAudit auditLogLocation="Application"
            suppressAuditFailure="false" 
            serviceAuthorizationAuditLevel="None" 
            messageAuthenticationAuditLevel="SuccessOrFailure" />
      </behavior>
</behaviors>

服务定义中引用的服务行为:

<services>
    <service behaviorConfiguration=" myAuditBehavior" ...
       <endpoint 

参考:http://msdn.microsoft.com/en-us/library/ms734737(v=vs.110).aspx

注意:您不显示配置部分的服务部分,因此您需要确保服务使用正确的行为。

此致