Thursday, December 6, 2012

EventLog.WriteEntry Error – Requested registry access is not allowed

EventLog.WriteEntry Error – Requested registry access is not allowed
http://iamwanwan.wordpress.com/2011/12/13/eventlog-writeentry-error-requested-registry-access-is-not-allowed/

Write to EventLog using .Net C#
http://limherlina.blogspot.ca/2008/09/write-to-eventlog-using-net-c.html

VS : Writing to the event log FAILED .. Requested registry access is not allowed.
http://zeetalks.wordpress.com/2008/08/16/vs-writing-to-the-event-log-failed-requested-registry-access-is-not-allowed/


http://support.microsoft.com/kb/329291
http://support.microsoft.com/kb/842795

An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
Additional information: Requested registry access is not allowed.
 
This problem occurs because the user account that we used to create log does not have sufficient permissions.
 
We can solve the problem by 2 solutions below.

1. Add an application pool on IIS
    Change the default setting of this application pool.
    In Identity tag: change predefined value "Network Service"  to "Local system"
    Set  appMail service app to use this application pool.
 
2. Give the ASP.NET user permission to read from the event log registry entries.
Select Start - Run, then enter: regedt32
Navigate/expand to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
Right click on this entry and select Permissions
Add the ASPNET user
Give it Read permission


No comments:

Post a Comment