![](/img/trans.png)
[英]System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security
[英]c# windows service in windows 7 The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security
我在Windows 7中運行C#Windows服務。我收到此錯誤。
{System.Security.SecurityException:找不到源,但是無法搜索某些或所有事件日志。 不可訪問的日志:安全性。 在System.Diagnostics.EventLog.SourceExists(字符串源,字符串machineName)在System.Diagnostics.EventLog.VerifyAndCreateSource(字符串sourceName,字符串currentMachineName)在System.Diagnostics.EventLog.FindSourceRegistration(字符串源,字符串machineName,布爾readOnly) .Diagnostics.EventLog.WriteEntry(字符串消息,EventLogEntryType類型,Int32 eventID,Int16類別,字節[] rawData),位於System.Diagnostics.EventLog.WriteEntry(字符串源,字符串消息,EventLogEntryType類型,Int32事件ID,Int16類別,字節[ ] System.Diagnostics.EventLog.WriteEntry中的rawData)(字符串源,字符串消息,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);**
任何建議表示贊賞
您在哪個帳戶下運行服務? 您可以嘗試將帳戶更改為LocalSystem,然后查看它是否可以解決您的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.