Search code examples
wcfwcf-security

SeAuditPrivilege error


My WCF service has this config setting for Security Audit:

<serviceSecurityAudit auditLogLocation="Default" 
                      suppressAuditFailure="false" 
                      ServiceAuthorizationAuditLevel="SuccessOrFailure" 
                      messageAuthenticationAuditLevel="SuccessOrFailure"/>

When a method is invoked for this service locally using ASP.Net Dev Server, it results into this error:

    <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
           <HelpLink i:nil="true"/>
           <InnerException i:nil="true"/>
           <Message>The process does not possess the 'SeAuditPrivilege' privilege which is required for this operation.</Message>
           <StackTrace>at System.IdentityModel.Privilege.EnableTokenPrivilege(SafeCloseHandle threadToken)
             ...

I am having Windows7 on my local machine.

Can anyone please guide what could be the issue?

Thank you!


Solution

  • To get rid of 'SeAuditPrivilege' error, I had to change

    auditLogLocation="Default"
    

    to

    auditLogLocation="Application"
    

    I am having Windows7 and for some reason, it was not able to write to "Security Logs" which is default for Windows 7 as this link from MS suggests - http://msdn.microsoft.com/en-us/library/system.servicemodel.auditloglocation%28v=vs.110%29.aspx

    Default
    
    Specifies the default location, which is determined by the operating system. 
    If writing to the Security log is supported (such as on Windows Vista and Windows 
    Server 2003 and later platforms), the default log location is the Security log. 
    Otherwise (such as in Windows XP SP2), the default log location is the Application log.
    

    I had to change the value from "Default" to "Application" to make it work.

    HTH.