System.Security.SecurityException: Requested registry access is not allowed RRS feed

  • Question

  • User-944813207 posted

    I just installed the june 2005 EL on a Windows Server 2003 and executed a simple web application which used to run just fine on a WinXP machine.

    Now it gives me this error:
    System.Security.SecurityException: Requested registry access is not allowed

    How do I fix it?

    Thursday, October 20, 2005 7:13 PM

All replies

  • User-504499122 posted

    Did you run the "Installed Services" ..

    Go to Start-> All Programs->Microsoft Patterns and Practices ->Enterprise Library -> Installed Services

    Thursday, October 20, 2005 9:32 PM
  • User-1154848535 posted
    Hi!, i have the same problem, but I need to upload my project to Brinkster, locally i set permision to asp_net accout to write into the event log, but in brinkste i cannot do this, please help me!!!!
    Tuesday, November 8, 2005 10:39 AM
  • User-1355649840 posted
    You'll have to recompile the Enterprise Library without the performance counters and WMI, then set your project references to the new DLLs. The process is described here:


    Tuesday, November 8, 2005 4:09 PM
  • User-1154848535 posted
    Thanks I will Try to do this!
    Friday, November 11, 2005 9:03 AM
  • User-1201110513 posted

    Registry Access Is Not Allowed" Error Message When ASP.NET Application Tries to Write New EventSource in the EventLog

    <script>function loadTOCNode(){}</script>
    Article ID : 329291
    Last Review : April 19, 2007
    Revision : 2.3
    This article was previously published under Q329291
    IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
    256986 (http://support.microsoft.com/kb/256986/EN-US/) Description of the Microsoft Windows Registry
    <script type="text/javascript"> var sectionFilter = "type != 'notice' && type != 'securedata' && type != 'querywords'"; var tocArrow = "/library/images/support/kbgraphics/public/en-us/downarrow.gif"; var depthLimit = 10; var depth3Limit = 10; var depth4Limit = 5; var depth5Limit = 3; var tocEntryMinimum = 1; </script><script src="http://support.microsoft.com/common/script/gsfx/kbtoc.js?9" type="text/javascript"></script><noscript><style>.toc{display: none;}</style></noscript>


    <script type="text/javascript">loadTOCNode(1, 'symptoms');</script>
    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.

    Back to the top


    <script type="text/javascript">loadTOCNode(1, 'cause');</script>
    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.

    Back to the top


    <script type="text/javascript">loadTOCNode(1, 'resolution');</script>
    WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk. 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 Approach

    <script type="text/javascript">loadTOCNode(3, 'resolution');</script>Create an event source under the Application event log in Registry Editor. To do this, follow these steps:
    1. Click Start, and then click Run.
    2. In the Open text box, type regedit.
    3. Locate the following registry subkey:
    4. Right-click the Application subkey, point to New, and then click Key.
    5. Type TEST for the key name.
    6. Close Registry Editor.

    Second Approach

    <script type="text/javascript">loadTOCNode(3, 'resolution');</script>The 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:
    1. Use Microsoft Visual Basic .NET or Microsoft Visual C# .NET to create a new Class Library named EventLogSourceInstaller. By default, the Class1.vb file or the Class1.cs file is created.
    2. In Solution Explorer, right-click EventLogSourceInstaller, and then click Add References.
    3. In the Add Reference dialog box, double-click System.Configuration.Install.dll, and then click OK.
    4. Rename the Class1.vb\Class1.cs to MyEventLogInstaller.vb\MyEventLogInstaller.cs.
    5. Replace the existing code in MyEventLogInstaller.vb or MyEventLogInstaller.cs with the following sample code:

    Visual Basic .NET Sample
    Imports System.Diagnostics
    Imports System.Configuration.Install
    Imports System.ComponentModel

    <RunInstaller(True)> _
    Public Class MyEventLogInstaller
    Inherits Installer
    Private myEventLogInstaller As EventLogInstaller

    Public Sub New()
    ' Create an instance of 'EventLogInstaller'.
    myEventLogInstaller = New EventLogInstaller()
    ' Set the 'Source' of the event log, to be created.
    myEventLogInstaller.Source = "TEST"
    ' Set the 'Log' that the source is created in.
    myEventLogInstaller.Log = "Application"
    ' Add myEventLogInstaller to 'InstallerCollection'.
    End Sub
    End Class
    Visual C# .NET Sample
    using System;
    using System.Diagnostics;
    using System.ComponentModel;
    using System.Configuration.Install;

    namespace EventLogSourceInstaller
    public class MyEventLogInstaller : Installer
    private EventLogInstaller myEventLogInstaller;

    public MyEventLogInstaller()
    //Create Instance of EventLogInstaller
    myEventLogInstaller = new EventLogInstaller();

    // Set the Source of Event Log, to be created.
    myEventLogInstaller.Source = "TEST";

    // Set the Log that source is created in
    myEventLogInstaller.Log = "Application";

    // Add myEventLogInstaller to the Installers Collection.

    6. On the Build menu, click Build Solution to create EventLogSourceInstaller.dll.
    7. Open the Visual Studio .NET Command Prompt.
    8. At the command prompt, change to the folder where EventLogSourceInstaller.dll is located.
    9. Run the following command to create the EventSource:
    InstallUtil EventLogSourceInstaller.dll
    Thursday, November 24, 2005 6:23 PM
  • User-1882367889 posted

    In some cases, system shows this error because it is unable to find the data source.

    try to find the data source of the grid and check whether it is functional or not.


    I got similar problem, after diagnosing it for hours, I found that the SP which I was calling to get the data was not present in the database.

    As soon as I executed that SP my program worked like a charm.


    Hope this helps :)

    Monday, July 11, 2011 10:35 AM