if you want host your asp app on linux with systemd in ASP.NET Core 5 : you must add Microsoft.Extensions.Hosting.Systemd
nuget package with this configuration:
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.UseSystemd() <----------------------- HERE
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
}) ;
}
}
but what about ASP.NET Core 6.0?
CodePudding user response:
in ASP.NET Core 6.0 :
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseSystemd(); <=-----------------------HERE