Open davidmatson opened 4 years ago
Seems like we should take a look at this. Hopefully there's a hook we can catch here. If it happens during process main we may be a little stuck since the exception is happening before any of the logging can be set up.
Just found this in a .NET core service I've written where there was a simple mistake in a connection string inside the appsettings.json file. It was throwing an exception, I was catching it and trying to log an error, but it never got logged and nothing useful in the event log either, so took me a while to debug.
Net start reports the service didn't respond to the control request in a timely fashion
This is probably due to https://github.com/dotnet/extensions/issues/2836 rather than the exception itself.
the startup exception is not logged in event viewer.
This is trickier since we don't have any logging set up yet. I'm surprised that the exception isn't going anywhere, since the runtime is supposed to write startup exceptions to the Application Event Log.
Triage: We'll do a quick investigation after fixing dotnet/extensions#2836 and see if the event shows up somewhere now that we're properly exiting.
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @eerhardt, @maryamariyan See info in area-owners.md if you want to be subscribed.
Author: | davidmatson |
---|---|
Assignees: | - |
Labels: | `area-Extensions-Hosting`, `untriaged` |
Milestone: | - |
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: