Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I avoid this SecurityException when writing to the Event Log?

I can't seem to write to the event log in .NET. I get the following exception:

System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

I don't want to access the Security log. How do I get around this error? Thanks!

like image 202
Jason Thompson Avatar asked Sep 01 '10 21:09

Jason Thompson


2 Answers

You can try to Start Visual Studio with Run As Administrator permission.

like image 52
Yagiz Ozturk Avatar answered Sep 18 '22 07:09

Yagiz Ozturk


You can try to create an event log in your application like Lachlan suggests but realize that this will require administrator privs. Instead I reccomend that you take care of this in your installer / deployment automation layer.

I use WiX so I recommend reading:

How do you create an event log source using WiX

like image 35
Christopher Painter Avatar answered Sep 22 '22 07:09

Christopher Painter