Requested registry access is not allowed (Enterprise Library)

Last post 10-23-2006 8:33 AM by Jacques Snyman. 2 replies.

Sort Posts:

  • Requested registry access is not allowed (Enterprise Library)

    10-21-2005, 2:37 PM
    • Loading...
    • Olly P
    • Joined on 10-21-2005, 6:18 PM
    • Posts 1

    Dear all who might be able to help...

    I'm trying to use the Enterprise Library logging and instrumentation application block (amongst others).  In particular, I want to log events to a new event log.  I've added the necessary configuration to my project web.config file using the Enterprise Library Configuration GUI.  This (I believe) simply requires adding a new Event Log Sink, setting the name of the log you want to create (I don't want to write to the default Application log, I want a new one) and the name for the source that will then write to that log.
    Then it just remains to add the new Event Log Sink as a destination for one of the categories.

    Unfortunately, when I attempt to write to the log using my application using the following simple few lines of code (thanks to Enterprise Library):

    LogEntry log = new LogEntry();
    log.EventId = 100;
    log.Message = "Logging to a brand new event log";
    log.Category = "General"; //General is default so use this category for now
    log.Priority = 1;
    Logger.Write(log);

    I am getting the 'Requested registry access is not allowed' error.

    Now for (way) too long, I've been trying to fix this and have tried every suggestion i can find out there - changing permissions for the event log registry settings, running InstallUtil.exe on the dlls (both in the bin of the app and in the installation folder for Enterprise Library) and I still can't fix it.

    Anyway, to cut a long story short, there's one thing which is now really bugging me:

    By using the LoggingQuickStart project which ships with Enterprise Library, and changing the app.config file of the application (again, using the Enterprise Manager Config GUI) such that a brand new log will be created, everything works fine - new log in the event list, new source, everything's great.  This suggests to me that all permissions/installations etc must be fine but that there's something I'm not doing in the code which I should be ...

    Does anyone have any clue what that Quick Start application which comes with Enterprise Library is doing which is so special?!

    Olly P

  • Re: Requested registry access is not allowed (Enterprise Library)

    11-24-2005, 1:29 AM
    • Loading...
    • Partyanimal
    • Joined on 09-06-2005, 6:57 AM
    • Posts 1

    Howdeee Olly P

    R u using the logging block for Asp.net application or for windows application.? cuz i face the same problem when i use this block in my distributed ASP.NET application a week ago and my resolutions were different from the recommended ways.

    My approach was in case of Web application
       1. Just right click the virtual directory in InutPub and go to security tab in its properties and add the ASp.NET user after selecting ur Pc/machine name in the locations tab with full rights ... thats it.....

    it works for meeee.... and i hope it works for u as well....

    but here is the recommended way for its resolution i hope it ends ur nightmare.....

    http://support.microsoft.com/default.aspx?scid=kb;en-us;329291 

    enjoy... 

  • Re: Requested registry access is not allowed (Enterprise Library)

    10-23-2006, 8:33 AM

    I looked at http://support.microsoft.com/default.aspx?scid=kb;en-us;329291 and then used regedit to change the permissions on the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog key to allow the account that asp.net is running in (eg. ASP.NET or Network service) full access to the key.

     

    Do this by running regedit and navigating to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog

    Right click on the Eventlog key and select Set permissions...

    Add the account that asp.net is running in to the list. Select the account and make sure read and write is selected.

    OK and exit regedit.

     

    This worked for me. Hope it 'll help someone somewhere.

     

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter