I am catching errors in my web app and writing custom error messages to the application log. The application is deployed on WIndows Server 2008 running IIS 7.0. When an error occurs and tries to write to the log I get the error:
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.SecurityEx
ception: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
how can it be fixed? on the provided snippet the error occurs in the second line "If not eventlog.sourceexists...."
scd.MachineName = "."
If Not EventLog.SourceExists(scd.Source, scd.MachineName) Then