command-line-api
command-line-api copied to clipboard
RFC: Add runAsDaemon option to UseHost
In my own project I wanted to start Asp.Net server from command line.
I also wanted to bind parsed CLI arguments into my option by BindCommandLine(), So I had to use UseHost(), which does not support running IHost forever and instead stops right after the startup.
I ended up re-writing my own commandline middleware which is mostly the same with UseHost ,but with one difference that it invokes host.RunAsync() instead of host.StartAsync().
So I thought it would be better to have this feature built in to this library.
Please don't merge yet, this PR has no test. I'm not even sure this is the right way to achieve my goal (I'm not super familiar to dotnet itself either). Any feedback is welcome.