源未找到,但一些或所有事件日志不能被搜索 [英] The source was not found, but some or all event logs could not be searched

查看:180
本文介绍了源未找到,但一些或所有事件日志不能被搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下异常。我在注册表编辑给予充分的控制Asp.net帐户Eventlogs。

  

[SecurityException异常:源未找到,但全部或部分事件   原木不能被搜索。不可访问的日志:安全]

  System.Diagnostics.EventLog.FindSourceRegistration(源字符串,字符串计算机名,布尔只读,已布尔wantToCreate)664
System.Diagnostics.EventLog.SourceExists(源字符串,字符串计算机名,布尔wantToCreate)+109
System.Diagnostics.EventLog.SourceExists(字符串源)+14 Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource()+41
 

我想这是因为在服务器上的一些配置问题?

解决方案

EventLog.SourceExists HKLM \ SYSTEM的子项列举\ CURRENTCONTROLSET \服务\事件日志,看它是否包含具有指定名称的子项。如果用户帐户下的code运行时没有读访问,它试图找到之前访问(在你的情况下,安全子)子项目标源,你会看到像你描述的一个例外。

有关处理此类问题的通常做法是注册事件日志源在安装时(以管理员帐户),再假设他们在运行时存在,使得由此产生的任何异常,如果目标事件日志源实际上并不在运行时存在被视为意外。

I am getting the following exception. I have given full control to Asp.net account on Eventlogs in Registry edit.

[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) +664
System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate) +109
System.Diagnostics.EventLog.SourceExists(String source) +14 Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource() +41

I guess this is due to some configuration issue on server?

解决方案

EventLog.SourceExists enumerates through the subkeys of HKLM\SYSTEM\CurrentControlSet\services\eventlog to see if it contains a subkey with the specified name. If the user account under which the code is running does not have read access to a subkey that it attempts to access (in your case, the Security subkey) before finding the target source, you will see an exception like the one you have described.

The usual approach for handling such issues is to register event log sources at installation time (under an administrator account), then assume that they exist at runtime, allowing any resulting exception to be treated as unexpected if a target event log source does not actually exist at runtime.

这篇关于源未找到,但一些或所有事件日志不能被搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆