写入.Net Core中的EventLog [英] Write to EventLog in .Net Core

查看:278
本文介绍了写入.Net Core中的EventLog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种在使用dnx的应用程序中写入Windows事件查看器的方法.但是,EventLog类在System.Diagnostics命名空间中不可用,因此我陷入了困境.还有其他方法可以写入EventViewer吗?

I need a way to write to Windows' event viewer in my app that's using dnx. But, the EventLog class isn't available in the System.Diagnostics namespace so I'm stuck. Is there any other way to write to the EventViewer?

推荐答案

NuGet Microsoft.Extensions.Logging.EventLog Version 2.1.1

CM> Install-Package Microsoft.Extensions.Logging.EventLog -Version 2.1.1

Program.cs文件中包含名称空间Microsoft.Extensions.Logging.EventLog

Include the namespace Microsoft.Extensions.Logging.EventLog in the Program.cs file

这解决了我的问题.

这篇关于写入.Net Core中的EventLog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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