Describe the bug
Exceptions starting up the host aren't reported as Windows service startup failures.
To Reproduce
- Use the program below.
- Start the service.
Expected behavior
Net start reports the service failed to start, and the startup exception is logged in event viewer.
Actual behavior
Net start reports the service didn't respond to the control request in a timely fashion, and the startup exception is not logged in event viewer.
Additional context
Program.cs:
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
static class Program
{
static void Main()
{
new HostBuilder()
.ConfigureLogging(l => l.AddConsole())
.ConfigureServices((s) =>
{
throw new InvalidOperationException("Configuring services failed for some reason.");
})
.UseWindowsService()
.Build()
.Run();
}
}
Describe the bug
Exceptions starting up the host aren't reported as Windows service startup failures.
To Reproduce
Expected behavior
Net start reports the service failed to start, and the startup exception is logged in event viewer.
Actual behavior
Net start reports the service didn't respond to the control request in a timely fashion, and the startup exception is not logged in event viewer.
Additional context
Program.cs: