I'm working with some old code (and frankly I don't know half of what it does) trying to move it over to IIS7.
One of the problems I see is that I get this error:
[SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.]
If I go manually to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security and set that key's (Security) permission to let "Everyone" have full access this goes away no problem. But obviously that's not the optimal solution.
Anyone know of a better way to remove this exception?
One way to fix this is to run a simple console application under full trust that writes a single EventLog entry under the offending source name. You'll have to do this once for each server.
From that moment on, you should be able to log under that source name. (at least that's been my observation.) It's just creating an unknown source that you cannot do from under ASP.NET, logging to an existing source should not be a problem.
Question is: do you know the source name? If you don't, temporarily granting access to Everyone, wait for a log message, and removing Everyone should also work.
The official Microsoft way is to create an installer which registers an Event Log Source.
From this thread:
Code and other solutions are also provided.