SecurityException event log for web application?

I have an application that writes messages to the event log. The source that I am passing to EventLog.WriteEntry does not exist, so the Framework is trying to create the source by adding it to the registry. It works fine if the user is an administrator, I get this, the user is not an administrator:

"System.Security.SecurityException: The requested registry access was not allowed." message.

How can I fix this?

Update

I created a registry with an administrator account manually in the registry. Now I have an error: System.Security.SecurityException: The requested registry access is not allowed.

I don't understand because I created a user in the Group Administrator ... what more do I need to do?

+1


source to share


3 answers


For your update, I found something that might help you:

Run regedt32
Navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
Right click on this entry and select Permissions
Add the ASPNET user
Give it Read permission

2. Change settings in machine.config file

Run Explorer
Navigate to WINDOWS or WINNT folder
Open Microsoft.NET folder
Open Framework folder
Open v1.1.4322 folder (folder name may be different, depending on what dotnet version is installed)
Open CONFIG folder
Open machine.config file using notepad (make a backup of this file first)
Locate processmodel tag (approx. at line 441)
Locate userName="machine" (approx. at line 452)
Change it to userName="SYSTEM"
Save and close the file
Close Explorer

3. Restart IIS

Run IISReset

      



Source here

+1


source


The "non-programmatic way" is to provide the user so that the user of the web application / web service has access to the registry (the event log is written to the event log).



0


source


None of this worked for me. Which changed the Application Pool ID from "ApplicationPoolIdentity" to "LocalSystem". Then add the LocalSystem Windows account to the Administrators group.

0


source







All Articles