是否存在始终可供 ASP.NET Web 应用程序写入的事件日志源?
背景故事,以防有人有看似不相关的解决方案:
我们的 ASP.NET Web 应用程序使用自己的事件日志源,但它无权创建它。因此,如果当 web 应用程序尝试写入条目时事件日志源不存在(安装说明指示管理员手动注册事件日志源,但是......),我们的 web 应用程序不会将任何内容放入出现问题时的事件日志。
我希望有另一个(与应用程序无关的)来源可以用来通知观看事件日志的人们。
Is there an event log source that's always available for writing by an ASP.NET webapp?
Backstory, in case anyone has a seemingly unrelated solution:
Our ASP.NET webapp uses its own event log source, but it doesn't have the rights to create it. So, if the event log source doesn't exist when the webapp tries to write the entry (install instructions dictate that the admin register the event log source manually, but......) , our webapp doesn't put anything in the event log when it has problems.
I'm hoping there's another (app-agnostic) source I can use to notify the folks who watch the event log.
发布评论
评论(5)
这篇知识库文章解释了这个问题
http://support.microsoft.com/ KB/329291
如果您使用解决方案中的第二种方法,您应该可以使其正常工作。
如果您不想这样做或者无法让它正常工作,另一种方法是使用
web.config
中的身份标签并模拟具有编辑权限的用户注册表。这只是此应用程序的安全整体,但如果您实施一些额外的安全措施,应该没问题。In this KB article it explains the issue
http://support.microsoft.com/kb/329291
If you use the second approach under the resolution you should get it to work.
If you don't want to do that or you can't get it to work correctly another way would be to use the identity tag in your
web.config
and impersonate a user that does have rights to edit the registry. This is a security whole only for this application but if you implement some extra security measures you should be fine.考虑过电子邮件通知吗?我猜有些管理员更喜欢通过手机收到通知。
如果客户端拒绝在 HKLM\System\CurrentControlSet\Services\EventLog\ 下创建密钥,您也可以打电话回家(调用 Web 服务将日志写回您自己的服务器)
Considered email notification? I guess some admins prefer to be notified from their cellphones.
You could also ring home (call a web service to write log back to your own server), in case the client refuse to create a key under HKLM\System\CurrentControlSet\Services\EventLog\
您可能无权从 Web 应用程序创建事件源,但如果没记错的话,您可以检查是否存在事件源。
在 global.asax 或自定义处理程序中,检查他们是否按照预期创建了它。如果他们没有,在每个页面上都会显示一个非常烦人的提醒 div。一旦他们按照预期创建了它,div 就会消失:)
You might not have access to create an event source from the web app, but if memory serves, you can check to see if one exists.
In the global.asax or a custom handler, check to see if they created it like they were supposed to. If they didn't, have a really annoying reminder div show on every page. As soon as they create it like they were supposed to, the div goes away :)
“ASP.NET XYZ0 “我认为,源代码将始终可供编写。
The "ASP.NET X.Y.Z.0" source will, I think, always be available for writing.
您应该能够毫无困难地写入内置事件日志(应用程序、安全性、系统)。
You should be able to write to the built-in event logs (Application, Security, System) without much difficulty.