c# windows service in windows 7 The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security
<p>I am  runing c# windows service in windows 7.i am getting this error.</p>

<blockquote>
  <p>{System.Security.SecurityException: The source was not found, but some
  or all event logs could not be searched.  Inaccessible logs: Security.
  at System.Diagnostics.EventLog.FindSourceRegistration(String source,
  String machineName, Boolean readOnly)    at
  System.Diagnostics.EventLog.SourceExists(String source, String
  machineName)    at
  System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName,
  String currentMachineName)    at
  System.Diagnostics.EventLog.WriteEntry(String message,
  EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
  at System.Diagnostics.EventLog.WriteEntry(String source, String
  message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[]
  rawData)    at System.Diagnostics.EventLog.WriteEntry(String source,
  String message, EventLogEntryType type, Int32 eventID)    at
  eFpdaDMSservice.Utils.GetRegValue(RegistryKey regKey, String
  strSubKey, String strName, String strDefault)</p>
</blockquote>

<p>I have given permissions in the registry</p>

<p>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog</p>

<p>it is breaking at this point</p>

<pre><code>strTempDir = Environment.GetEnvironmentVariable("temp");
            **strLogDir = Utils.GetRegValue(Registry.LocalMachine,REG_KEY,"logdir",strTempDir);**
</code></pre>

<p>Any suggestions appreciated</p>
