未找到源,但无法搜索部分或全部事件日志

The source was not found, but some or all event logs could not be searched(未找到源,但无法搜索部分或全部事件日志)
本文介绍了未找到源,但无法搜索部分或全部事件日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下异常.我已经在注册表编辑的事件日志中完全控制了 Asp.net 帐户.

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

[SecurityException: 未找到源,但部分或全部事件无法搜索日志.无法访问的日志:安全性.]

[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通过HKLMSYSTEMCurrentControlSetserviceseventlog的子键枚举查看如果它包含具有指定名称的子项.如果运行代码的用户帐户在找到目标源之前对其尝试访问的子项(在您的情况下为 Security 子项)没有读取权限,您将看到异常就像你描述的那样.

EventLog.SourceExists enumerates through the subkeys of HKLMSYSTEMCurrentControlSetserviceseventlog 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.

这篇关于未找到源,但无法搜索部分或全部事件日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)