Article ID: 329291 - Last Review: December 3, 2007 - Revision: 2.10 PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET Application Tries to Write New EventSource in the EventLogThis article was previously published under Q329291 On This PageSYMPTOMS When you use ASP.NET to create a new event source in the event log, you may receive the following error message: System.Security.SecurityException: Requested registry access is
not allowed. CAUSE By default, the user token of the ASP.NET worker process is
ASPNET (or NetworkService
for applications that run on Internet Information Services [IIS] 6.0). The problem in the
"Symptoms" section occurs because your account does not have the correct user
rights to create an event source. RESOLUTIONImportant This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base: 322756
(http://support.microsoft.com/kb/322756/
)
How to back up and restore the registry in Windows To resolve this problem, a user who has administrative
rights must create the event source before you run the ASP.NET Web Application.
To create an event source, use one of the following approaches.First ApproachCreate an event source under the Application event log in Registry Editor. To do this, follow these steps:
Second ApproachThe EventLogInstaller class in the System.Diagnostics namespace permits you to install and configure an event log that your application reads from or writes to while running. You can create an event source by using EventLogInstaller. To do this, follow these steps:
MORE INFORMATIONSteps to Reproduce the Behavior
REFERENCESFor more information, visit the following Microsoft Web
sites: http://msdn2.microsoft.com/en-us/library/f5dcf6h3(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/f5dcf6h3(vs.71).aspx)
http://msdn2.microsoft.com/en-us/library/system.diagnostics.eventlog(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/system.diagnostics.eventlog(vs.71).aspx)
APPLIES TO
| Article Translations
|

Back to the top
