I’m trying to write a simple event log but i confront with “System.Security.SecurityException: The source was not found...” and i searched a lot but couldn’t find an efficient solution, I really really appreciate if someone help me with that I know that the source needed to be created and the key must be registered but what is the key and How should i do that?
String source =“DemoTestApplication”;
String log = “DemoEventLog”;
EventLog demolog=new EventLog(log);
EventLog demolog=new EventLog(log);
demolog.Source=source;
demolog.writeEntry(“This is the first message to the log”,EventLogEntryType.Information);
Try this:
Generally it is better to create the event log source when running with administrator/elevated privileges, e.g., during installation of your software.