Web 应用程序的事件日志 SecurityException?
我有一个将消息写入事件日志的应用程序。 我传递给 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于您的更新,我找到了一些可能对您有帮助的内容:
源代码在这里
For your update I have found something that might help you :
The source is here
“非编程方式”是授予使用您的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).
这些对我来说都没有效果。 诀窍是将应用程序池标识从“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.