I am getting the above-mentioned error when I try to start the worker service on the target machine, a Windows server. I tried everything, but without any success. I am still getting the error. I'm using .NET Core 3.1 and Microsoft.Extensions.Logging 7.0.0. Here is the code that is causing the problem:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
})
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService();
})
.UseWindowsService();
Here are some helpful links that I have already tried:
I will be grateful if someone can help me.
UPDATE: I'm using Microsoft.Extensions.Hosting 7.0.0 and System.Diagnostics.EventLog 7.0.0. If I downgrade the packages to 6.0.0, it works.