找不到源,但无法搜索部分或全部事件日志。无法访问的日志:安全性。 [英] The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

查看:100
本文介绍了找不到源,但无法搜索部分或全部事件日志。无法访问的日志:安全性。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过对以下代码进行编码来动态地在事件查看器中创建事件日志:



i want to create a event log in event viewer dynamically by coding i code like this:

if (!EventLog.SourceExists("MySource"))
{
EventLog.CreateEventSource("MySource","MyNewLog"); 
}
// Create an EventLog instance and assign its source.
EventLog eventLog = new EventLog();

// Setting the source
eventLog.Source = "MySource";

// Write an entry to the event log.
eventLog.WriteEntry("An error has been generated by the application", EventLogEntryType.Error, 1002);

推荐答案

这通常是由于没有足够的权限来读取注册表键入HKLM \SYSTEM\CurrentControlSet \services\eventlo,在本例中为安全密钥(/ log)。



签出http://stackoverflow.com/questions/286060/what-do-i-need-to-change-to-allow-my-iis7-asp-net-3-5-application-to- create-an-e / 7848414#7848414 [ ^ ]了解更多细节。



但简而言之,您需要某种形式的管理员访问权来创建日志源,但是一旦创建,非管理员就可以使用它。





-DB
This is generally caused by having insufficient privileges to read the registry key at HKLM\SYSTEM\CurrentControlSet\services\eventlo, in this case, the Security key (/log).

Check out http://stackoverflow.com/questions/286060/what-do-i-need-to-change-to-allow-my-iis7-asp-net-3-5-application-to-create-an-e/7848414#7848414[^] for some more detail.

But in short, you’ll need some form of administrator access to create the log source, but once created, a non-administrator can then use it.


-DB


这篇关于找不到源,但无法搜索部分或全部事件日志。无法访问的日志:安全性。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆