找不到源中事件 ID 的描述
当我将日志写入 Windows 事件日志时,我收到以下事件,该消息的根本原因是什么,以及如何修复它?非常感谢
事件 ID 51001 的描述 无法找到源 RRWS。 引发此问题的组件 您的本地未安装事件 计算机或安装是 已损坏。您可以安装或修复 本地计算机上的组件。
如果事件源自另一个 电脑上,显示信息有 与事件一起保存。
包含以下信息 与事件:
测试日志消息
消息资源存在,但是 在中找不到该消息 字符串/消息表
When I write a log into windows event log, I get the event below, what's the root cause of this message, and how can I fix it? Many Thanks
The description for Event ID 51001
from source RRWS cannot be found.
Either the component that raises this
event is not installed on your local
computer or the installation is
corrupted. You can install or repair
the component on the local computer.If the event originated on another
computer, the display information had
to be saved with the event.The following information was included
with the event:test log messge
the message resource is present but
the message is not found in the
string/message table
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
使用“EventCreate”从命令行在应用程序日志下创建事件源后,我收到此错误。
此命令在以下位置创建一个新密钥:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application
如果您查看已创建的密钥(例如 SourceTest),将会有一个名为
EventMessageFile
的字符串值,对我来说设置为%SystemRoot%\System32\EventCreate.exe
。将其更改为
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll
删除
CustomSource
和TypesSupported
值。这应该会停止“事件 ID 的描述......”消息。
I got this error after creating an event source under the Application Log from the command line using "EventCreate".
This command creates a new key under:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application
If you look at the Key that's been created (e.g. SourceTest) there will be a string value called
EventMessageFile
, which for me was set to%SystemRoot%\System32\EventCreate.exe
.Change this to
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll
Delete the
CustomSource
andTypesSupported
values.This should stop the "The description for Event ID...." message.
现实世界的解决方案怎么样?
如果您需要的只是一种“快速而肮脏”的方式将某些内容写入事件日志,而无需注册“自定义源”(需要管理员权限)或提供“消息文件”(需要工作和头痛)只需这样做:
这样您就可以写入现有的“应用程序”日志,而不会出现烦人的“找不到事件 ID 0 的描述”
如果您想要解释“神奇”部分,我在博客上介绍了它 此处
How about a real world solution.
If all you need is a "quick and dirty" way to write something to the event log without registering "custom sources" (requires admin rights), or providing "message files" (requires work and headache) just do this:
This way you'll be writing to an existing "Application" log without the annoying "The description for Event ID 0 cannot be found"
If you want the "magic" part explained I blogged about it here
重新启动系统!
我的一个朋友也遇到了完全相同的问题。他尝试了所有描述的选项,但似乎没有任何效果。经过多次研究,也是微软的描述 ,他得出结论,重新启动系统,就成功了!
操作系统似乎不会在所有情况下刷新已注册事件源的列表。只有重新启动后,您才能确保事件源已正确注册。
Restart your system!
A friend of mine had exactly the same problem. He tried all the described options but nothing seemed to work. After many studies, also of Microsoft's description, he concluded to restart the system and it worked!!
It seems that the operating system does not in all cases refresh the list of registered event sources. Only after a restart you can be sure the event sources are registered properly.
您需要为其创建事件源和消息文件。代码如下所示:
然后您需要创建一个 消息文件。还有这篇 文章 解释了一些事情(我没有全部读完,但它看起来相当完整)。
You need to create an event source and a message file for it. Code looks something like this:
Then you will need to create a message file. There is also this article that explains things (I did not read it all but it seems fairly complete).
使用 PowerShell 创建事件日志和源:
您将需要消息 dll 来避免您遇到的问题。
Use PowerShell to create your event log and source:
You'll need the messages dll to avoid the problem you are seeing.
我也偶然发现了这一点 - 尽管是由另一种可能性引起的:事件标识符(在
#define
中“混淆”)将严重性设置为错误< /em> (事件标识符中所述的两个高位)。由于事件查看器显示事件标识符(低位 16 位),因此不可能匹配...作为参考,我根据自己的研究整理了一组提示在进行故障排除和修复此问题时:
如果您的日志条目不以“消息资源存在,但在字符串/消息表中找不到消息 “(与原来的问题相对):
如果您需要添加/编辑注册表信息,请记住:
EventLog
服务(或重新启动系统,如 @BrunoBieri 所暗示)。如果您不想创建自定义 DLL 资源,请注意常用的事件消息文件有一些注意事项:
EventLogMessages.dll
(如 @Matt 暗示)上升到0xFFFF
EventCreate.exe
“仅”上升到0x3E9
%1
ReportEvent
的所有字符串仍然可以通过查看事件详细信息进行检查(选择所需的事件,转到详细信息选项卡并展开EventData)如果您在记录的事件中仍然收到“找不到”信息(原始问题):< /p>
I also stumbled on this - although caused by yet another possibility: the event identifier (which was "obfuscated" in a
#define
) was setting severity to error (the two high-order bits as stated in Event Identifiers). As Event Viewer displays the event identifier (the low-order 16 bits), there couldn't be a match...For reference, I've put together a set of tips based in my own research while troubleshooting and fixing this:
If your log entry doesn't end with "the message resource is present but the message is not found in the string/message table" (as opposed to the original question):
If you need to add/edit registry information, remember to:
EventLog
service (or restart the system, as hinted by @BrunoBieri).If you don't wish to create a custom DLL resource, mind that commonly available event message files have some caveats:
EventLogMessages.dll
(as hinted by @Matt) goes up to0xFFFF
EventCreate.exe
"only" goes up to0x3E9
%1
ReportEvent
can still be inspected by looking into event details (select the desired event, go to Details tab and expand EventData)If you're still getting "cannot be found" in your logged events (original question):
这通常是由写入事件日志然后被卸载或移动的程序引起的。
This is usually caused by a program that writes into the event log and is then uninstalled or moved.
我也面临类似的问题。经过大量研究后,我做了以下工作
我根据这篇文章验证了步骤 http://www.codeproject.com/Articles/4166/Using-MC-exe-message-resources-and-the-NT-event-lo
一切似乎都已就位。除了一件事..当我偶然发现这个 msdn http://msdn.microsoft.com/en-us/library/windows/desktop/aa363661(v=vs.85).aspx
正如最后一段所说..
'如果应用程序调用 RegisterEventSource 并传递在注册表中找不到的源名称,则事件日志记录服务默认使用应用程序日志。但是,由于没有消息文件,事件查看器无法将任何事件标识符或事件类别映射到描述字符串,并且将显示错误。因此,您应该向应用程序的注册表添加一个唯一的事件源,并指定一个消息文件。”
因此,RegisterEventSource 中的应用程序名称与注册表中的应用程序名称不匹配。我修复了这个问题,现在它可以工作了......
因此,如果您遇到此问题,请仔细检查您的注册表项。
I also faced similar problem. After doing lot of research I did following
I verified the steps according to this article http://www.codeproject.com/Articles/4166/Using-MC-exe-message-resources-and-the-NT-event-lo
Everything seemed to be in place. Except one thing..i realised it when I stumbled on this msdn http://msdn.microsoft.com/en-us/library/windows/desktop/aa363661(v=vs.85).aspx
As last paragraph says..
'If the application calls RegisterEventSource and passes a source name that cannot be found in the registry, the event-logging service uses the Application log by default. However, because there are no message files, the Event Viewer cannot map any event identifiers or event categories to a description string, and will display an error. For this reason, you should add a unique event source to the registry for your application and specify a message file.'
So my application name in RegisterEventSource was not matching with the application name in registry. I fixed this and now it works...
So please double check your registry entries if you face this problem.
如果您在创建事件源之前打开事件日志查看器(例如在安装服务时),您将收到该错误消息。您不需要重新启动操作系统:您只需关闭并打开事件查看器即可。
注意:我不提供自定义消息文件。事件源的创建使用默认配置 如马特的回答所示。
If you open the Event Log viewer before the event source is created, for example while installing a service, you'll get that error message. You don't need to restart the OS: you simply have to close and open the event viewer.
NOTE: I don't provide a custom messages file. The creation of the event source uses the default configuration, as shown on Matt's answer.
对我来说,问题是我的目标配置文件意外设置为“.Net Framework 4 客户端配置文件”。当我使用“.Net Framework 4”重建有问题的服务时,问题就消失了!
For me, the problem was that my target profile by accident got set to ".Net Framework 4 Client profile". When I rebuilt the service in question using the ".Net Framework 4", the problem went away!
其他问题很有帮助;我想为刚刚发现此问题的任何人提供详细答复。这是针对 Windows Server 2019 上的上述问题。
1 - 尝试使用代码创建源
代码应检查源并创建它(如果不存在)。
示例代码(powershell w/.NET):
2 - 重新启动 PC/服务器
不太可能有帮助,但却是一个简单的选择。
3 - EventCreate CMD 工具
尝试使用命令行工具“eventcreate”来编写条目,它可能会为您提供有关问题的更多详细信息:
错误:
这意味着您无法添加到不存在的源t 由 eventcreate 创建。这意味着源是由应用程序在安装等过程中创建的,您不应尝试执行此操作,而应选择一个新的源名称(或根本不选择)
4 - 验证注册表
计算机\ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application<源名称>
其中显示替换为您尝试使用的源的位置。如果您看到 EventMessageFile 设置为 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\EventLogMessages.dll 之类的内容,那么就可以了。如果您看到像 c:\program files\my program.exe 这样的应用程序路径,那么它将无法工作。
5 - 其他选项
有多种方法可以解决此问题,但很复杂。基本上,如果可能的话,最好使用另一个源名称。如果不需要该密钥,您可以复制它(例如重复Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application<源名称>),然后删除它并查看从那时起使用eventcreate是否存在任何问题。
Other aswers are helpful; I wanted to provide a details response for anyone who just discovered this issue. This was in reference to the issue above on Windows Server 2019.
1 - Try creating the source with code
The code should check for the source and create it if it does not already exist.
Sample code (powershell w/.NET):
2 - Reboot PC/Server
Unlikely to help but an easy option.
3 - EventCreate CMD tool
Try using the cmd line tool 'eventcreate' to write the entry, it may give you more detail into the problem:
Error:
which means you can't add to sources that weren't created by eventcreate. This means that the the source was created by an application during install etc. and you should not attempt to make this work and instead pick a new source name (or none at all)
4 - Verify registry
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application<source name>
Where it says replace with the source you are trying to use. If you see EventMessageFile set to something like C:\Windows\Microsoft.NET\Framework64\v4.0.30319\EventLogMessages.dll, then it's OK. If you see an application path like c:\program files\my program.exe, then it will not work.
5 - Other options
there are ways to work around this but it is complicated. Basically it is far better to just use another source name if at all possible. If the key isn't necessary you could duplicate it (e.g. dupicate Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application<source name>), then delete it and see if there are any issues from using eventcreate from then on.
改进@Alex的答案,我建议如下:
这里不要指定
category
参数,这一点很重要。如果您这样做,这对于.NET Runtime
所谓的魔法来说是相同的,即将出现。
Improving on the answer by @Alex, I suggest the following:
It is important here not to specify
category
parameter. If you do, and this is the same for the.NET Runtime
so-called magic, theis going to appear.