Web应用程序的事件日志SecurityException?

时间:2008-11-15 18:36:58

标签: c# events .net-2.0 c#-2.0

我有一个将消息写入事件日志的应用程序。我传递给EventLog.WriteEntry的源不存在,因此Framework尝试通过将源添加到注册表来创建源。如果用户是管理员,它可以正常工作我得到以下用户不是管理员:

“System.Security.SecurityException:不允许请求的注册表访问。”信息。

我该如何解决?

更新

我已在注册表中手动创建具有管理员帐户的注册表。现在,我有错误:System.Security.SecurityException:不允许请求的注册表访问。

我不明白,因为我在群组管理员中创建了一个用户...我还需要做些什么?

3 个答案:

答案 0 :(得分:1)

为了您的更新,我找到了可能对您有所帮助的内容:

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

The source is here

答案 1 :(得分:0)

“非编程方式”是向用户授予您的Web应用程序/ Web服务用户访问注册表的权限(事件日志写入事件日志中)。

答案 2 :(得分:0)

这些都不适合我。诀窍是改变了应用程序池标识来自" ApplicationPoolIdentity"到#34; LocalSystem"。然后将LocalSystem Windows帐户放入Administrators组。

相关问题