Thursday, April 24, 2014

System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security

Recently, i encountered an error after deploying a web application over IIS 7. It was working fine with IIS v6.0 with Windows Server 2003 but on IIS 7 it started giving an error "System.Security.SecurityException" on the line: EventLog.SourceExists(sourceName). Here is what i did to solve this issue:-

- Go to Registry Editor on Windows Server 2008

- Choose HKLM-> SYSTEM->CurrentControlSet->services->eventlog
- Grant Read permission on "Security" node to IIS AppPool\DefaultAppPool User

It will solve the issue of searching through event sources to find whether this source already exists or not.