Link to home
Start Free TrialLog in
Avatar of Big Monty
Big MontyFlag for United States of America

asked on

permissions error when trying to write to the event log

I'm getting the following error message when trying to write to the event log in my aspx page:

code to write to the event log:
EventLog.WriteEntry ......

error message
[SecurityException: Requested registry access is not allowed.]
   System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +51
   Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +7469849
   System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) +366
   System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName) +194
   System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +205
   System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +87
   System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type) +14
   TagTeam.ttDownloadHandler.ProcessError(HttpContext context, String errorMessage, EventLogEntryType entryType) in e:\InetPub\Products\RevBase\Applications\DotNet\ttDownloadHandler\sl.ashx:395
   TagTeam.ttDownloadHandler.ProcessRequest(HttpContext context) in e:\InetPub\Products\RevBase\Applications\DotNet\ttDownloadHandler\sl.ashx:106
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Open in new window


I've inherited this aspx app from someone else, and am attempting to get it set up properly on my dev machine. I've checked a bunch of different permissions, including folder permissions as well as AppPool permissions (it runs under its own AppPool). I'm only writing to the event log when an error occurs, I would be perfectly happy trying to get the exact error message instead, but have had no luck.

.NET configurations are def NOT my strong point, so just a heads up on that :)

If you need any additional info, I'll be happy to provide it.

Cheers
Josh
ASKER CERTIFIED SOLUTION
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Big Monty

ASKER

how do I determine what the aspnet user is? Is that in reference to the IUSR account?

will I need to reboot the machine and/or restart IIS after I make these changes?
To determine the user, you'll want to look at the identity property of the Application Pool -User generated imageIf you find that the ApplicationPoolIdentity is used, you can use this TID to determine the user:

https://docs.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities

After you set the registry permissions as instructed by Kimputer you should not need to perform a restart.  But you may need to restart the Windows Event Log Service if you find that your entries are not added.

-saige-
I gave ApplicationPoolIdentity, which is what is listed as the account being used on my App Pool, full permissions and got the same error message.
Untitled.png
Which log are you trying to write to?

-saige-
application event log
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i'm getting a different message now, and looking in the event log, i see it's being written to by my app, so I think this is all set. Going to do some more testing, will close this out in a bit.

Many thanks for the help!
thanks for the assistance :)