如何写入事件日志时,我避免这种SecurityException异常? [英] How do I avoid this SecurityException when writing to the Event Log?

查看:103
本文介绍了如何写入事件日志时,我避免这种SecurityException异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法写入到事件日志中.NET。我得到以下异常:

I can't seem to write to the event log in .NET. I get the following exception:

System.Security.SecurityException:源未找到,但一些或所有事件日志不能被搜索。不可访问的日志:安全性

System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

我不希望访问安全日志。我该如何解决这个错误?谢谢!

I don't want to access the Security log. How do I get around this error? Thanks!

推荐答案

您可以尝试创建一个事件日志在应用程序像拉克兰建议,但意识到这将需要管理员PRIVS。相反,我reccomend你照顾这个在您的安装/部署自动化层

You can try to create an event log in your application like Lachlan suggests but realize that this will require administrator privs. Instead I reccomend that you take care of this in your installer / deployment automation layer.

我使用WiX的,所以我建议阅读:

I use WiX so I recommend reading:

你如何创建一个事件日志使用维克斯

这篇关于如何写入事件日志时,我避免这种SecurityException异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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