Artificial intelligent assistant

asp.net core mvc にてStdin(CLI)を受け付ける方法 Asp.Net Core MVC - CentOS7 wget curl cron mail forward PHP "/usr/bin/php -q /home/user/public_html/index.php controller method" $fp = @fopen('php://stdin', 'r'); Asp.Net Core MVC

ASP.NET Core`Main`(`Program.cs`)Web


public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup()
.Build();
// host

host.Run();
}
}


`IWebHost.Run()`Web`args``Run()`


if (args[0] == "controller"
&& args[1] == "action")
{
//
}
else
{
host.Run();
}


`host.Services.GetService(Type)`Dependency Injection`Type`HTTP


var hoge = (HogeService)host.GetService(typeof(HogeService));
hoge.ExecuteFuga();

// HogeControllerHogeService`ExecuteFuga`


`args``IActionDescriptorCollectionProvider`

Web`host``ServiceCollection``Configure`DI

`Console.In`()`Console.OpenStandardInput`()

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a02ee9ec3004036954cea9bd1938fc88