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<Worker>();
})
.UseWindowsService();
Here are some helpful links that I have already tried:
Link1 Link2 Link3
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.
Downgrading Microsoft.Extensions.Hosting 7.0.0 and System.Diagnostics.EventLog 7.0.0 to 6.0.0 seems to eliminate the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With