Hi, I'm using vs2012.
i'm getting the following error when my code try to create new event log and event source. I then added impersonation code, stepping through it is impersonating successfully. the impersonated account is added to the local Administrator group of the server but still I would get security error. What other permission still needed? Thank you.
Both code below would give security error
//if ((!EventLog.Exists(sLog)) || (!EventLog.SourceExists(sSource)))
// EventLog.CreateEventSource(sSource, sLog);
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.]
System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate) +806
System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate) +315
System.Diagnostics.EventLog.SourceExists(String source) +22
XXXXXXXXXXXXXXXXXXXXXXX.ErrLog.LogIt(String msg) +143
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12347355
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12346873
System.Web.UI.Page.ProcessRequest(HttpContext context) +99
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165