本文介绍了安全性异常写入事件日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨; 我正在尝试使用以下内容写入事件日志: public const string EVENT_LOG_NAME =" Windward Portal" ;; if(!EventLog.SourceExists(EVENT_LOG_NAME)) EventLog.CreateEventSource(EVENT_LOG_NAME," Application"); 我和我获得例外: [SecurityException:不允许请求的注册表访问。] System.ThrowHelper.ThrowSecurityException(Exceptio nResource resource)+48 Microsoft.Win32.RegistryKey.OpenSubKey(字符串名称,布尔可写) +2780713 System.Diagnostics.EventLog.CreateEventSource(甚至tSourceCreationData sourceData)+360 System.Diagnostics.EventLog.CreateEventSource(Stri ng source,String logName)+41 net.windward。 中的portal.audit.Auditor.WriteEvent(Strin g msg, EventLogEntryType elet)C:\ src \ RevPortal \ WindindPortalEngine \ net\windw ard\ portal \ audit\Auditor.cs:155 net.windward.portal.audit.Auditor..cctor()in C:\ src \ b $ b - 谢谢 - 戴夫 david_at_windward_dot_net http://www.windwardreports.com 小隔间战争 - http://www.windwardreports.com/film.htm 解决方案 Hi;I am trying to write to the event log using:public const string EVENT_LOG_NAME = "Windward Portal";if (!EventLog.SourceExists(EVENT_LOG_NAME))EventLog.CreateEventSource(EVENT_LOG_NAME, "Application");And I am getting the exception:[SecurityException: Requested registry access is not allowed.]System.ThrowHelper.ThrowSecurityException(Exceptio nResource resource) +48Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)+2780713System.Diagnostics.EventLog.CreateEventSource(Even tSourceCreationDatasourceData) +360System.Diagnostics.EventLog.CreateEventSource(Stri ng source, StringlogName) +41net.windward.portal.audit.Auditor.WriteEvent(Strin g msg,EventLogEntryType elet) inC:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:155net.windward.portal.audit.Auditor..cctor() inC:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:142Any idea why?--thanks - davedavid_at_windward_dot_net http://www.windwardreports.comCubicle Wars - http://www.windwardreports.com/film.htm 解决方案 这篇关于安全性异常写入事件日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 01:57
查看更多