I use Event log like that:
if(!EventLog.SourceExists("Service"))
EventLog.CreateEventSource("Service","Sending notification email error");
EventLog.WriteEntry("Service",
System.String.Format("Sending notification email error {0} \n {1} \n From {2} \n To {3} ",
Error.Message,Error.StackTrace,From!=null?From.Address:"",
To!=null?string.Join(",",To.ToList()):""),
EventLogEntryType.Warning,2);
I have that code in two projects of same solution. But when I try to log information on production - one code log successfully, when other give me error
The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security
I can not find what make a difference that other is not working :/
I do like on this blog but i refer to .net 4.0 folder cause my app use .net4.
Any idea?
You must be administrator to create an event log source. Do you have the correct rights?