Adding a runnable script to a ASP.NET Core Application
<p>I currently have a ASP.NET Core application implementing a basic web API. I have a need to write a script that hooks into the same environment with access to at least the database, but can't find a place to add new entry points to the application. I can easily look at <code>string[] args</code> in the Main method in Program.cs and not start the server, but I don't see how I can load up the environment and run arbitrary code without just standing up the normal Kestrel server. I'm pretty new to the .NET world so I'm hoping there is an easy way to do this that I've just failed to find in the documentation.</p>

<p>Basically I'd like to be able to run something like <code>dotnet run foo</code> which would execute some synchronous piece of code on the server instead of starting up the normal kestrel server.</p>