G
Guest
I am trying to write to the event log from ASP.NET, on Windows XP SP1.
As soon as I try to write an event (or even query the source with
EventLog.SourceExists() or EventLog.LogNameFromSourceName()) I get a
SecurityException "Requested registry access is not allowed.".
I have read the KB article associated with this error message, which
indicates the source needs to be created outside of ASP.NET. I created an
Installer class, and ran InstallUtil against it successfully. I even
verified the source was created by writing to it from a command-line program
(as opposed to ASP.NET).
I have also used Regedt32 to grant the local ASPNET account has Full Control
permissions on the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
registry key (and its children). I have rebooted the machine to make sure
the old permissions were not cached somewhere.
FYI, the event source writes to a custom event log (which was created by
running InstallUtil against my installer class).
The website is configured to allow Anonymous access, and I do not use
impersonation.
The exception details (I use a modified form of the EMAB to build the log
text) indicate the ThreadIdentityName is blank, and the WindowsIdentityName
is MACHINE\ASPNET.
What else needs to be done to allow ASP.NET to write to an event source in a
custom event log?
As soon as I try to write an event (or even query the source with
EventLog.SourceExists() or EventLog.LogNameFromSourceName()) I get a
SecurityException "Requested registry access is not allowed.".
I have read the KB article associated with this error message, which
indicates the source needs to be created outside of ASP.NET. I created an
Installer class, and ran InstallUtil against it successfully. I even
verified the source was created by writing to it from a command-line program
(as opposed to ASP.NET).
I have also used Regedt32 to grant the local ASPNET account has Full Control
permissions on the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
registry key (and its children). I have rebooted the machine to make sure
the old permissions were not cached somewhere.
FYI, the event source writes to a custom event log (which was created by
running InstallUtil against my installer class).
The website is configured to allow Anonymous access, and I do not use
impersonation.
The exception details (I use a modified form of the EMAB to build the log
text) indicate the ThreadIdentityName is blank, and the WindowsIdentityName
is MACHINE\ASPNET.
What else needs to be done to allow ASP.NET to write to an event source in a
custom event log?