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

发布于 2024-07-09 13:42:42 字数 371 浏览 5 评论 0原文

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

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

我该如何解决这个问题?

更新

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

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

I have an app that writes messages to the event log. The source I'm passing in to EventLog.WriteEntry does not exist, so the Framework tries to create the source by adding it to the registry. It works fine if the user is an Admin by I get the following whe the user is not an admin:

"System.Security.SecurityException : Requested registry access is not allowed." message.

How can I fix that?

Update

I have create the registry with the Admin account manually in the registry. Now, I have the error : System.Security.SecurityException: Requested registry access is not allowed.

I do not understand because I have create a user in the Group Administrator... what do I have to do more?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

羁客 2024-07-16 13:42:43

对于您的更新,我找到了一些可能对您有帮助的内容:

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

源代码在这里

For your update I have 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

The source is here

寻梦旅人 2024-07-16 13:42:43

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

The "non-programming way" is to grant the user that user your web application/web service with access to registry (Event Log are written in the event log).

他是夢罘是命 2024-07-16 13:42:43

这些对我来说都没有效果。 诀窍是将应用程序池标识从“ApplicationPoolIdentity”更改为“LocalSystem”。 然后将LocalSystem Windows 帐户放入Administrators 组。

Nothing of these worked out for me. What did the trick was alter the Application Pool Identity from "ApplicationPoolIdentity" to "LocalSystem". Then put LocalSystem Windows account into the Administrators group.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文