Custom Event Log Write Error

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Custom Event Log Write Error

    We are experiencing the following error when writing to a custom log file:
    "Requested registry access is not allowed."

    We have created the custom log file using the code below and then add full
    permissions to the ASPNET account at the Registry Key
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog.

    We do not experience the error when writing to the "Application" Event log
    or if we run the code from a windows form application.

    // Code Fails when writing to custom event log "SR_AppLog
    EventLog appLog = new EventLog("SR_AppLog", ".");
    appLog.Source = "SR_AppDev";
    appLog.WriteEntry("foo bar: database error");
    appLog.Dispose();


    //Code executs when writing to "Application" event log
    EventLog appLog = new EventLog("Application");
    appLog.Source = "SR_AppSrc";
    appLog.WriteEntry("foo bar: database error");
    appLog.Dispose();

    //Installer class to create the custom event log
    namespace EventLogSourceInstaller

    {

    [RunInstaller(true)]

    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 = "SR_AppDev";

    // Set the Log that source is created in

    myEventLogInstaller.Log = "SR_AppLog";


    // Add myEventLogInstaller to the Installers Collection.

    Installers.Add(myEventLogInstaller);

    }

    }

    }


    TJO Guest

  2. Similar Questions and Discussions

    1. Getting Error: Event Type 'flash.event:event' is unavailable ?????
      Hi, I am not using Cairngorm or anything, but trying to get an app built first without it then look into it. I am getting this error however...
    2. Help ! - App move to IIS6 - cannot write to event log!
      I've researched like mad and haven't found a real answer to this: I have a large application, classic ASP and VB6 COM objects that has been moved...
    3. Event Log Write Access error.
      I have a web service that runs on Win2003 under an Application Pool with user identity. If that user is a member of Administrators group, then the...
    4. SecurityException when i try to write to the event
      Dear all, why do i get the following exception when i try to write to the event log from a webform. and how can i resolve it? Description: The...
    5. event monitor write to table in V8
      Hi, I'm trying to create an event monitor that writes to tables in a specific tablespace (TEST_TBS) but when I include the IN tablespace clause,...
  3. #2

    Default Re: Custom Event Log Write Error

    Have a look at that:
    329291 PRB: "Requested Registry Access Is Not Allowed" Error Message When
    [url]http://support.microsoft.com/?id=329291[/url]

    Cheers,
    Stefano Pronti

    Microsoft Developer Support

    This posting is provided "AS IS" with no warranties, and confers no rights.


    "TJO" <no@spam.net> wrote in message
    news:O2OYiCGtDHA.2252@TK2MSFTNGP09.phx.gbl...
    > We are experiencing the following error when writing to a custom log file:
    > "Requested registry access is not allowed."
    >
    > We have created the custom log file using the code below and then add full
    > permissions to the ASPNET account at the Registry Key
    > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog.
    >
    > We do not experience the error when writing to the "Application" Event log
    > or if we run the code from a windows form application.
    >
    > // Code Fails when writing to custom event log "SR_AppLog
    > EventLog appLog = new EventLog("SR_AppLog", ".");
    > appLog.Source = "SR_AppDev";
    > appLog.WriteEntry("foo bar: database error");
    > appLog.Dispose();
    >
    >
    > //Code executs when writing to "Application" event log
    > EventLog appLog = new EventLog("Application");
    > appLog.Source = "SR_AppSrc";
    > appLog.WriteEntry("foo bar: database error");
    > appLog.Dispose();
    >
    > //Installer class to create the custom event log
    > namespace EventLogSourceInstaller
    >
    > {
    >
    > [RunInstaller(true)]
    >
    > 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 = "SR_AppDev";
    >
    > // Set the Log that source is created in
    >
    > myEventLogInstaller.Log = "SR_AppLog";
    >
    >
    > // Add myEventLogInstaller to the Installers Collection.
    >
    > Installers.Add(myEventLogInstaller);
    >
    > }
    >
    > }
    >
    > }
    >
    >

    Stefano Pronti [MS] Guest

  4. #3

    Default Re: Custom Event Log Write Error

    we have followed these instructions on your recommended article. The
    problem with the article is that it explains how to set permission for the
    "Application" event log. It then goes on to show how to create your own
    Even Log using a custom installer class which is also what we have done.
    Our problem is that we can write to the Application event log but not to the
    custom event log. We only get the Acccess not allowed error when writing to
    the custom event log. Writing to the Application event log is no problem.

    Has anyone done this before? What sercurity setting should I look for ?



    "Stefano Pronti [MS]" <stefanop@online.microsoft.com> wrote in message
    news:%23NiKjFZtDHA.1788@tk2msftngp13.phx.gbl...
    > Have a look at that:
    > 329291 PRB: "Requested Registry Access Is Not Allowed" Error Message When
    > [url]http://support.microsoft.com/?id=329291[/url]
    >
    > Cheers,
    > Stefano Pronti
    >
    > Microsoft Developer Support
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    rights.
    >
    >
    > "TJO" <no@spam.net> wrote in message
    > news:O2OYiCGtDHA.2252@TK2MSFTNGP09.phx.gbl...
    > > We are experiencing the following error when writing to a custom log
    file:
    > > "Requested registry access is not allowed."
    > >
    > > We have created the custom log file using the code below and then add
    full
    > > permissions to the ASPNET account at the Registry Key
    > > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog.
    > >
    > > We do not experience the error when writing to the "Application" Event
    log
    > > or if we run the code from a windows form application.
    > >
    > > // Code Fails when writing to custom event log "SR_AppLog
    > > EventLog appLog = new EventLog("SR_AppLog", ".");
    > > appLog.Source = "SR_AppDev";
    > > appLog.WriteEntry("foo bar: database error");
    > > appLog.Dispose();
    > >
    > >
    > > //Code executs when writing to "Application" event log
    > > EventLog appLog = new EventLog("Application");
    > > appLog.Source = "SR_AppSrc";
    > > appLog.WriteEntry("foo bar: database error");
    > > appLog.Dispose();
    > >
    > > //Installer class to create the custom event log
    > > namespace EventLogSourceInstaller
    > >
    > > {
    > >
    > > [RunInstaller(true)]
    > >
    > > 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 = "SR_AppDev";
    > >
    > > // Set the Log that source is created in
    > >
    > > myEventLogInstaller.Log = "SR_AppLog";
    > >
    > >
    > > // Add myEventLogInstaller to the Installers Collection.
    > >
    > > Installers.Add(myEventLogInstaller);
    > >
    > > }
    > >
    > > }
    > >
    > > }
    > >
    > >
    >
    >

    TJO Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139