Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

'ILoggingBuilder' does not contain a definition for 'AddEventLog'

$
0
0

Hi,

I am trying to use AddEventLog for Worker Service on ASP.NET Core 3.1.3 I have installed NuGet Microsoft.Extensions.Logging.EventLog

Problem is I am getting the error 'ILoggingBuilder' does not contain a definition for 'AddEventLog'

Here is my code:

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseWindowsService()
    .ConfigureLogging((context, logging) =>
    {
        logging.AddEventLog(new EventLogSettings()
        {
            SourceName = "MySource",
            LogName = "MyLogName"
        });
    })
    .ConfigureServices((hostContext, services) =>
    {
        services.AddHostedService<Worker>();
    });
}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>