public MyNewService()
{
InitializeComponent();
if (!System.Diagnostics.EventLog.SourceExists("MySource"))
{
System.Diagnostics.EventLog.CreateEventSource(
"MySource","MyNewLog");
}
eventLog1.Source = "MySource";
eventLog1.Log = "MyNewLog";
}
我按照MSDN上的写法用的,但是一执行到System.Diagnostics.EventLog.SourceExists("MySource")这句就会
产生异常,提示"未找到源,但未能搜索某些或全部事件日志。不可访问的日志: Security。"
请问这该怎样解决呢?
{
InitializeComponent();
if (!System.Diagnostics.EventLog.SourceExists("MySource"))
{
System.Diagnostics.EventLog.CreateEventSource(
"MySource","MyNewLog");
}
eventLog1.Source = "MySource";
eventLog1.Log = "MyNewLog";
}
我按照MSDN上的写法用的,但是一执行到System.Diagnostics.EventLog.SourceExists("MySource")这句就会
产生异常,提示"未找到源,但未能搜索某些或全部事件日志。不可访问的日志: Security。"
请问这该怎样解决呢?
解决方案 »
- 我想设计下这样的界面,但是在C#中如何选择按钮控件呢?
- datagridview 将数据集显示在自定义列头下
- C#socket通讯中,在发送方进行数据发送时判断发送是否成功,如果不成功重发?
- nhibernate调用mysql函数问题
- C# 调用C++ DLL
- C#统计WORD中文字数
- 要写入到流中的字节超过指定的 Content-Length 字节大小
- 用C#写windows服务程序,用installUtil.exe卸载失败,注册表删除不完全!!!急
- 那里有InstallShield 11免费版下载?
- DataGrid 随comboBox而变化
- NetMeeting端口映射的问题
- vs2003做安装部署怎样让用户不能更变安装程序文件夹???????
按理说不应该出错的,我还将AutoLog设为了false。
还有我在其它非服务的程序中就可以正常使用EventLog。
hdt(倦怠) 能讲一下原因吗?万分感谢!