title: WCF Exception during writing an event into event log
body: <p>Exception during writing event log on host machine(Windows 2008 R2) hosting WCF Service named my machine
   from WCFClient (Windows 7) running within domain but on a different machine.</p>
  
  <p>WCF Client is impersonated to access resources on Server.</p>
  
  <p>So far following links have not helped</p>
  
  <p><a href="http://support.microsoft.com/kb/2028427#appliesto" rel="nofollow noreferrer">http://support.microsoft.com/kb/2028427#appliesto</a></p>
  
  <p><a href="http://forums.asp.net/t/1131903.aspx" rel="nofollow noreferrer">http://forums.asp.net/t/1131903.aspx</a></p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/Aa379567" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/Aa379567</a> (Detals about SDDL)
  <a href="http://blogs.dirteam.com/blogs/jorge/archive/2008/03/26/parsing-sddl-strings.aspx" rel="nofollow noreferrer">http://blogs.dirteam.com/blogs/jorge/archive/2008/03/26/parsing-sddl-strings.aspx</a> (SDDL)</p>
  
  <p>similar question on SO without any answer 
  <a href="https://stackoverflow.com/questions/6456444/allow-wcf-services-writing-to-custom-event-log-under-windows-2008-r2-server">https://stackoverflow.com/questions/6456444/allow-wcf-services-writing-to-custom-event-log-under-windows-2008-r2-server</a></p>
  
  <p>Exception is as follows</p>
  
  <p>System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Cannot open log for source 'MyService'. You may not have write access. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
  System.InvalidOperationException: Cannot open log for source 'MyService'. You may not have write access. ----> System.ComponentModel.Win32Exception: Access is denied</p>
  
  <p>--- End of inner ExceptionDetail stack trace ---
     at System.Diagnostics.EventLogInternal.OpenForWrite(String currentMachineName)
     at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName)
     at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
     at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type)
     ...................
   .....................</p>