【问题标题】:c# windows service in windows 7 The source was not found, but some or all event logs could not be searched. Inaccessible logs: Securityc# windows 7中的windows service 找不到源,但是部分或全部事件日志无法搜索到。无法访问的日志:安全性
【发布时间】: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#


    【解决方案1】:

    您在哪个帐户下运行服务?您可以尝试将 Account 更改为 LocalSystem 并查看它是否可以解决您的问题。

    【讨论】:

      猜你喜欢
      • 2014-08-05
      • 2011-08-14
      • 1970-01-01
      • 2019-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-22
      相关资源
      最近更新 更多