安全性异常写入事件日志 [英] security exception writing to event log
问题描述
嗨;
我正在尝试使用以下内容写入事件日志:
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
我不相信ASPNET用户帐户有权写入
事件日志。您必须模拟具有更高级别的
权限的帐户才能执行此操作。如果你在谷歌搜索,应该有一些不错的选择
。
-
希望这有帮助,
Mark Fitzpatrick
前微软FrontPage MVP 199?-2006
" David Thielen" < th ***** @ nospam.nospamwrote in message
news:B6 ************************* ********* @ microsof t.com ...
嗨;
我正在尝试使用以下方法写入事件日志:
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(String name,布尔值可写)
+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\RePortal \ WindwardPortalEngine \ net \windward\ portal \ audit \ Auditor.cs:155
net.windward.portal.audit.Auditor..cctor()in
C:\\ \\ src\RePortal\WindwardPortalEngine\\\
et\windward\ portal \ audit \ Auditor.cs:142
知道为什么吗?
>
-
谢谢 - 戴夫
david_at_windward_dot_net
http://www.windwardreports.com
小隔间战争 - http://www.windwardreports.com/film.htm
让sysadmin知道发生了什么事情的建议方法是什么?
然后呢?我正在测试日志文件的代码路径无法打开所以我不能记录错误。我需要把它放在某个地方。
其他人做什么?我不想存储用户名/密码来冒充
因为这是一个很大的安全漏洞。
-
谢谢 - 戴夫
david_at_windward_dot_net
http:// www。 windwardreports.com
小隔间战争 - http://www.windwardreports.com/film.htm
" Mark Fitzpatrick"写道:
我不相信ASPNET用户帐户有权写入
事件日志。您必须模拟具有更高级别的
权限的帐户才能执行此操作。如果你在谷歌搜索,应该有一些不错的选择
。
-
希望这有帮助,
Mark Fitzpatrick
前微软FrontPage MVP 199?-2006
" David Thielen" < th ***** @ nospam.nospamwrote in message
news:B6 ************************* ********* @ microsof t.com ...
嗨;
我正在尝试使用以下方法写入事件日志:
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(String name,布尔值可写)
+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\RePortal\WindwardPortalEngine\\\
et\windward\ portal \ audit \ Auditor.cs:155
net.windward.portal.audit.Auditor..cctor()in
C:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\想法为什么?
-
谢谢 - 戴夫
david_at_windward_dot_net
http://www.windwardreports.com
小隔间战争 - http://www.windwardreports.com/film.htm
默认情况下,asp.net无法访问注册表。你应该添加
应用程序节点,消息文件密钥到注册表,并给asp.net访问。
- bruce(sqlwork.com)
" David Thielen" < th ***** @ nospam.nospamwrote in message
news:B6 ************************* ********* @ microsof t.com ...
嗨;
我正在尝试使用以下方法写入事件日志:
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(String name,布尔值可写)
+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\RePortal \WindwardPortalEngine \ net \windward\ portal \ audit \ Auditor.cs:155
net.windward.portal.audit.Auditor..cctor()in
C:\\ \\ src\RePortal\WindwardPortalEngine\\\
et\windward\ portal \ audit \ Auditor.cs:142
知道为什么吗?
>
-
谢谢 - 戴夫
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) +48
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
+2780713
System.Diagnostics.EventLog.CreateEventSource(Even tSourceCreationData
sourceData) +360
System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName) +41
net.windward.portal.audit.Auditor.WriteEvent(Strin g msg,
EventLogEntryType elet) in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:155
net.windward.portal.audit.Auditor..cctor() in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:142
Any idea why?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
I don''t believe the ASPNET user account has the permissions to write to the
event log. You would have to impersonate an account with a higher level of
permissions in order to do that. There should be some good alternatives
though if you do a search on google.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"David Thielen" <th*****@nospam.nospamwrote in message
news:B6**********************************@microsof t.com...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)
+48
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
+2780713
System.Diagnostics.EventLog.CreateEventSource(Even tSourceCreationData
sourceData) +360
System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName) +41
net.windward.portal.audit.Auditor.WriteEvent(Strin g msg,
EventLogEntryType elet) in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:155
net.windward.portal.audit.Auditor..cctor() in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:142
Any idea why?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
What is the suggested way of letting the sysadmin know something bad happened
then? I am testing the code path of the log file cannot be opened so I can''t
log the error. I need to put it somewhere.
What do others do? I don''t want to store a username/password to impersonate
as that is a big security hole.
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
"Mark Fitzpatrick" wrote:
I don''t believe the ASPNET user account has the permissions to write to the
event log. You would have to impersonate an account with a higher level of
permissions in order to do that. There should be some good alternatives
though if you do a search on google.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"David Thielen" <th*****@nospam.nospamwrote in message
news:B6**********************************@microsof t.com...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)
+48
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
+2780713
System.Diagnostics.EventLog.CreateEventSource(Even tSourceCreationData
sourceData) +360
System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName) +41
net.windward.portal.audit.Auditor.WriteEvent(Strin g msg,
EventLogEntryType elet) in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:155
net.windward.portal.audit.Auditor..cctor() in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:142
Any idea why?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
by default asp.net does not have access to registery. you should add the
applicaion node, message file key to registery, and give asp.net access.
-- bruce (sqlwork.com)
"David Thielen" <th*****@nospam.nospamwrote in message
news:B6**********************************@microsof t.com...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)
+48
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
+2780713
System.Diagnostics.EventLog.CreateEventSource(Even tSourceCreationData
sourceData) +360
System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName) +41
net.windward.portal.audit.Auditor.WriteEvent(Strin g msg,
EventLogEntryType elet) in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:155
net.windward.portal.audit.Auditor..cctor() in
C:\src\RePortal\WindwardPortalEngine\net\windward\ portal\audit\Auditor.cs:142
Any idea why?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
这篇关于安全性异常写入事件日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!