Windows 7 上的 log4net EventLogAppender 问题
您好,我在 Windows7 上遇到 EventLogAppender 问题。 配置EventLogAppender的代码是:
var elAppender = new EventLogAppender
{
ApplicationName = "MyLog",
LogName = "MyLog",
Layout = new PatternLayout(default_format),
Threshold = Level.Error
};
错误消息是:
The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
你能帮我解决这个问题吗? 谢谢。
Hello I have problem with EventLogAppender on the Windows7.
Code for config EventLogAppender is:
var elAppender = new EventLogAppender
{
ApplicationName = "MyLog",
LogName = "MyLog",
Layout = new PatternLayout(default_format),
Threshold = Level.Error
};
The error message is:
The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
Could you help me to resolve this problem?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你关闭UAC了吗?或者您的应用程序是否以提升的权限运行?如果没有,它将无法工作,除非您在运行应用程序之前手动创建事件源(可能作为安装程序的一部分):
http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.createeventsource.aspx
Did you turn off UAC? Or does your application run with elevated permissions? If not it will not work unless you create the event source manually before you run the application (maybe as part of an installer):
http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.createeventsource.aspx