Jun 2, 2009

System.Security.SecurityException: Requested registry access is not allowed. when writing to event log

I got this error when I try to create an eventlog source and when I try to write to the new event log (after resorting to manually creating the event log source) with my ASP.NET application.
See the end of this post for the full error message and stack trace.
This seems to be a very commom problem - and not consistent either. My guess is that it's due to the tightening of security recently, ie XP SP2. Use of the Network Service account (on win2k3) or AD accounts can help.
To resolve you need to give the ASP.NET user permission to read from the event log registry entries. And here's how:
1. Select Start - Run, then enter: regedt32
2. Navigate/expand to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
3. Right click on this entry and select Permissions
4. Add the ASPNET user
5. Give it Read permission

No comments:

Post a Comment