“ILoggingBuilder”不包含“AddEventSourceLogger”的定义,并且找不到接受“ILoggingBuilder”类型的第一个参数的可访问扩展方法“AddEventSourceLogger”
Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
{
// Requires `using Microsoft.Extensions.Logging;`
// logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddConsole();
logging.AddDebug();
logging.AddEventSourceLogger();
})
.UseApplicationInsights()
.UseStartup<StartupConsole>()
.UseDefaultServiceProvider(options => options.ValidateScopes = false);
我目前正在使用 .net-core 2.1 并安装了用于使用 Microsoft.Extensions.Logging 的 nuget。
最佳答案
确保您已经安装了 Microsoft.Extensions.Logging.EventSource NuGet 包。
关于asp.net - ILoggingBuilder 没有参数为 0 的 AddEventSourceLogger。如何初始化此日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58817192/