【发布时间】:2011-10-19 18:57:10
【问题描述】:
我在 windows 7 中运行 c# windows 服务。我收到此错误。
{System.Security.SecurityException: 找不到源,但有些 或无法搜索所有事件日志。无法访问的日志:安全性。 在 System.Diagnostics.EventLog.FindSourceRegistration(字符串源, String machineName, Boolean readOnly) at System.Diagnostics.EventLog.SourceExists(字符串源,字符串 机器名称)在 System.Diagnostics.EventLog.VerifyAndCreateSource(字符串源名称, 字符串 currentMachineName) 在 System.Diagnostics.EventLog.WriteEntry(字符串消息, EventLogEntryType 类型,Int32 eventID,Int16 类别,Byte[] rawData) 在 System.Diagnostics.EventLog.WriteEntry(字符串源,字符串 消息,EventLogEntryType 类型,Int32 eventID,Int16 类别,Byte[] rawData)在 System.Diagnostics.EventLog.WriteEntry(字符串源, 字符串消息,EventLogEntryType 类型,Int32 eventID)在 eFpdaDMSservice.Utils.GetRegValue(RegistryKey regKey, String strSubKey, String strName, String strDefault)
我已在注册表中授予权限
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog
此时它正在崩溃
strTempDir = Environment.GetEnvironmentVariable("temp");
**strLogDir = Utils.GetRegValue(Registry.LocalMachine,REG_KEY,"logdir",strTempDir);**
任何建议表示赞赏
【问题讨论】:
标签: c#