You receive the "Requested registry access is not allowed" error message when you try to create a custom event log (842795)
The information in this article applies to:
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base: 256986 Description of the Microsoft Windows registry SYMPTOMSIf you log on to a computer as a regular user, and if you try to use Microsoft Visual
Studio .NET to create a custom event log to register events, you may receive the following error message: An
unhandled exception of type 'System.Security.SecurityException' occurred in
mscorlib.dll Additional information: Requested registry access is not
allowed. CAUSEThis problem occurs because the user account that you used to log on does not have sufficient permissions. The first time that you call the EventLog.CreateEventSource() method to create a custom event log, the custom event log
entry is created under the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
To create this subkey entry, you must have
permission to write. However, the regular
user account does not have permission to write. Therefore, you receive the error message that is mentioned in the
"Symptoms" section. WORKAROUNDWarning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk. To
work around this problem, use one of the following methods: - Grant permission to create a custom event log
- Install the custom event log as an administrator
Grant permission to create a custom event log- Log on to the computer as an administrator.
- Click Start, click
Run, type regedit in the
Open box, and then click OK. The Registry
Editor window appears.
- Locate the following registry
subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog - Right-click Eventlog, and then click
Permissions. The Permissions for Eventlog
dialog box appears.
- Click Advanced. The Advanced
Security Settings for Eventlog dialog box appears.
- In the Name column, double-click
the Users group. The Permission Entry for Eventlog dialog box
appears.
- Select the Set Value check box,
select the Create Subkey check box, and then click
OK.
- Quit Registry Editor, and then log off from the administrator account.
- Log on to the computer as a regular user.
- Try to create a custom event log by using Visual Studio .NET, and then try to write to this event log by
using an application that is built on Visual Studio .NET.
Install the custom event log as an administrator- Log on to the computer as an administrator.
- Use the CreateEventSource method in Visual Studio .NET to create a custom event log and an event log source.
- Log off from the administrator account.
- Log on to the computer as a regular user.
- Run the application to write the entry to the custom event
log.
REFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
329291
"Requested registry access is not allowed" error message when ASP.NET application tries to write new EventSource in the EventLog
Modification Type: | Major | Last Reviewed: | 8/31/2006 |
---|
Keywords: | kbtshoot kberrmsg kbRegistry kbpermissions kbEventLog kbaccounts kbprb KB842795 kbAudDeveloper |
---|
|
|
©2004 Microsoft Corporation. All rights reserved.
|
|