gpt4 book ai didi

Windows 事件日志 - 事件 ID 0

转载 作者:可可西里 更新时间:2023-11-01 14:50:46 24 4
gpt4 key购买 nike

我有一个使用 EventLog 进行日志记录的 Windows 服务应用程序。在我运行的应用安装程序中:

eventcreate /L APPLICATION /SO "My App" /T SUCCESS /id 1 /D "Initialised Log"

然后在我的 C# 应用程序记录器中,我执行以下操作:

EventLog.WriteEntry(message, EventLogEntryType.Error, 1, 0, details);

但是,当我查看应用程序事件日志时,除了我的事件之外,我还看到了 EventID 为 0 的条目。我无法使用 eventcreate 创建 ID=0 条目(表示 ID 必须 >=1)。那么是什么在创造这些事件呢?有什么方法可以阻止事件日志提示安装损坏吗?

一个示例条目说:

The following information was included with the event:

Service started successfully.

the message resource is present but the message is not found in the string/message table

最佳答案

你收到文字了吗:

无法找到来自源 myApp 的事件 ID 0 的描述。引发此事件的组件未安装在您的本地计算机上,或者安装已损坏。您可以在本地计算机上安装或修复该组件。

在所有事件日志条目之前,跟在正确的错误之后?

我在使用 eventcreate 后遇到了这个问题,只能通过编辑注册表来摆脱它

HKLM\System\CurrentControlSet\Services\Eventlog\Application\MyEventSource

customSource (1)
EventMessageFile %SystemRoot%\System32\EventCreate.exe
TypesSupported (7)

我改成了

EventMessageFile C:\Windows\Microsoft.NET\Framework\v4.0.30319\EventLogMessages.dll

然后我所有的事件日志条目(甚至是旧的)看起来都正确,没有提示损坏

关于Windows 事件日志 - 事件 ID 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16475153/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com