I keep getting this error message when trying to write to the Event log from a console app. Here's how i write to it
public static void WriteToEventLog(Exception ex)
{
string mySource = "Export Task";
if (!EventLog.SourceExists(mySource))
EventLog.CreateEventSource(mySource, "Application");
EventLog myLog = new EventLog();
myLog.Source = mySource;
myLog.WriteEntry(ex.ToString());
}
Does anyone know why this is happening and how i can fix it?