警告 - 运行 wevtutil 时无法访问提供程序资源
我需要帮助解决尝试创建 Windows 事件提供程序时无法访问“提供程序”资源的问题。我使用 ManGen 实用程序创建清单文件,并将“.exe”文件命名为我的消息和资源文件。我编译了“生成了带有 exe 文件的 .rc' 文件和预期的 '.res' 文件。但是,当我运行 wevtutil 时,我不断收到“资源不可访问”警告。
I need help solving the "Provider '' resources not accessible when trying to create a windows event provider. I create my manifest file with the ManGen utility, and name my '.exe' file as my message and resource file. I compile the '.rc' file with my exe file and the expected'.res' file are generated. However, when I run wevtutil I keep getting the 'resources not accessible' warning.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当您安装清单(例如
wevtutil im manifest.man
)时,如果资源不可用,您应该会看到某种警告:要获取一些其他信息,请尝试检索以下资源之一的信息:出版商。例如:
好的,上面表明存在权限问题,所以让我使路径可访问并重试:
对于上面的内容,看起来资源没有正确编译。
如果你使用VS
File->Open
并在资源查看器中打开你的exe,你应该能够看到编译的资源。你至少应该有一个“WEVT_TEMPLATE”条目。为了正确编译资源,需要向
csc
传递资源,如下所示:When you install your manifest (e.g.
wevtutil im manifest.man
), you should see some sort of a warning if the resources aren't available:To get some additional information, try to retrieve information on one of the publishers. For example:
Ok, the above suggests a permissions problem, so let me make the path accessible and try again:
For the above, it looks like the resource didn't get compiled in correctly.
If you go
File->Open
with VS and open your exe in the resource viewer you should be able to see the resources that were compiled in. You should at least have a "WEVT_TEMPLATE" entry.For the resource to be compiled in correctly,
csc
needs to be passed the resource as follows:您正在注册的 dll 需要具有一组特定的文件权限。我怀疑事件日志服务在“本地服务”帐户下运行。所以仅仅授予 SYSTEM 访问权限是不够的。我通过授予我的电脑上的“用户”组“读取和执行”权限来解决问题。
我遇到了一个棘手的问题,花了一天的时间才找到答案。我共享了我的项目工作文件夹,然后取消共享。由于某种原因,这删除了“用户”访问权限。我认为这就是 Windows SDK 中的事件跟踪示例将所有 dll 复制到 C 驱动器下的特殊文件夹并从那里安装提供程序的原因。当您在 C 盘下创建文件夹时,USERS 组将自动获得访问权限。
The dll you are registering needs to have a particular set of file permissions. I suspect that the event logging service runs under the "local service" account. So just giving SYSTEM access rights is not enough. I solved by problem by giving the "USERS" group on my PC "read & execute" priviledges.
I ran into a nasty problem that took a day to track down. I shared my project working folder and then unshared it. For some reason this removed the "USERS" access priviledges. I think this is the reason than the event tracing samples in the windows SDK copy all the dlls to a special folder under the C drive and install the provider from there. When you create folders under C drive the USERS group is given access automatically.
我遇到了完全相同的错误,但解决方案与已发布的其他答案略有不同。我必须打开清单文件并更改
resourceFileName
和messageFileName
属性,以使用应用程序可执行文件的绝对路径。I had the exact same error but the solution was slightly different to the other answers that have already been posted. I had to open the manifest file and change the
resourceFileName
andmessageFileName
attributes to use absolute paths to the application executable.我遇到了类似的问题。解决方案是
如果您的清单文件名为
manifest.man
和manifest.dll
,然后授予每个人读取权限
icacls %~dp0\manifest.* /t /grantEveryone:R
使用绝对路径安装(如果使用批处理文件,可以使用
%~dp0
变量)wevtutil im %~dp0\manifest.man /rf:"%~dp0\manifest.dll" /mf:"%~dp0\manifest.dll"
I experienced the similar problem. The solution is to
If your manifest files are called
manifest.man
andmanifest.dll
, thengrant read access to everyone
icacls %~dp0\manifest.* /t /grant Everyone:R
use absolute paths to install (
%~dp0
variable could be used if you are using a batch file)wevtutil im %~dp0\manifest.man /rf:"%~dp0\manifest.dll" /mf:"%~dp0\manifest.dll"