ASP.NET 应用程序访问 Windows Server 2008 R2 上的事件日志
任何人都可以解释为什么会发生以下情况:
我的 ASP.NET 应用程序需要访问应用程序事件日志。
当我最初访问 Web 应用程序时,它返回“安全”异常(这是预期的,因为我尚未授予写入应用程序事件日志的权限)。
然后,我向 IIS_IUSRS 组授予以下注册表项的读/写权限:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog。此操作的结果是,我的 Web 应用程序开始工作。
现在我删除了授予 IIS_IUSRS 组的权限。但 我的 Web 应用程序继续工作(尽管我希望再次引发“安全”异常)
那么,为什么网络应用程序继续工作,尽管有写入应用程序日志的权限 已被删除?
Can anyone explain why the following happens:
My ASP.NET application requires access to Application event log.
When I access web application initially, it returns "Security" exception (which is expected, as I haven't granted permissions to write to Application event log yet).
Then I give read/write permissions to IIS_IUSRS group on the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog. As a result of this action my web application starts working.
Now I remove those permissions I've granted to IIS_IUSRS group. But
my web application keeps working (although I'd expect "Security" exception raised again)
So, why web application keeps working, although permissions to write to Application log
have been removed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在事件日志中创建事件源所需的权限与写入现有事件源所需的权限之间存在差异。创建事件源需要更高的权限。
以下是访问事件日志的来源:
There is a difference between the permissions required to create an event source in the event log, and the permissions required to write to an existing event source. A higher permission is needed to create the event source.
Here's a source re accessing the event log:
只要您不重新启动 ASP.NET 应用程序和/或 IIS,打开事件日志的权限就可能会被缓存。取决于您在代码中的表现。
It could be so that the permission to open the event log is caches as long as you do not restart the ASP.NET application and/or IIS. Depends on how you have done in your code.