c# - Facing error in Event Log Creation -
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace custom_event_log_app { public partial class form1 : form { public form1() { initializecomponent(); } private void button_eventandsourcelog_click(object sender, eventargs e) { if (textbox_logname.text != string.empty && textbox_logsource.text != string.empty) { system.diagnostics.eventlog.createeventsource(textbox_logsource.text, textbox_logname.text); messagebox.show("event log , source created"); } else { messagebox.show("event log , source required...!"); } } } }
security exception
description: application attempted perform operation not allowed security policy. grant application required permission please contact system administrator or change application’s trust level in configuration file.
exception details: system.security.securityexception: source not found, or event logs not searched. inaccessible logs: security
stack trace:
[securityexception: source not found, or event logs not searched. inaccessible logs: security.]
run visual studio administrator .then u rights of administrator .that's .problem solved
Comments
Post a Comment