Pregunta

Tengo una aplicación que escribe mensajes en el registro de eventos. La fuente que estoy pasando a EventLog.WriteEntry no existe, por lo que Framework intenta crear la fuente agregándola al registro. Funciona bien si el usuario es un administrador, obtengo lo siguiente cuando el usuario no es un administrador:

" System.Security.SecurityException: no se permite el acceso al registro solicitado. " mensaje.

¿Cómo puedo arreglar eso?

Update

He creado el registro con la cuenta de administrador manualmente en el registro. Ahora, tengo el error: System.Security.SecurityException: no se permite el acceso al registro solicitado.

No entiendo porque he creado un usuario en el Administrador del grupo ... ¿qué debo hacer más?

¿Fue útil?

Solución

Para su actualización, he encontrado algo que podría ayudarlo:

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

La fuente está aquí

Otros consejos

La " forma no programada " es otorgarle al usuario que usa su aplicación web / servicio web acceso al registro (el registro de eventos se escribe en el registro de eventos).

Nada de esto funcionó para mí. El truco fue alterar la identidad del grupo de aplicaciones de " ApplicationPoolIdentity " a "LocalSystem". Luego, coloque la cuenta de Windows LocalSystem en el grupo Administradores.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top