Sunday, February 27, 2011

Windows Service or ASP.NET - System.Security.SecurityException when writing to Event Log

The solution was to give NetworkService and LocalService read (Full) permission on the EventLog/Security key.

To resolve you need to give the NetworkService/LocalService or ASP.NET user permission to read from the event log registry entries.

1. Select Start - Run, then enter: regedt32
2. Navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
3. Right click on this entry and select Permissions.
4. Add the NetworkService/LocalService/ASPNET user.
5. Give it Read (Full) permission.
Share/Bookmark

No comments: