42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace GenericWebHost
|
|
{
|
|
public class Program
|
|
{
|
|
public static async Task Main(string[] args)
|
|
{
|
|
var host = new HostBuilder()
|
|
.ConfigureAppConfiguration((hostContext, config) =>
|
|
{
|
|
config.AddEnvironmentVariables();
|
|
config.AddJsonFile("appsettings.json", optional: true);
|
|
config.AddCommandLine(args);
|
|
})
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
})
|
|
.UseFakeServer()
|
|
.ConfigureWebHost((hostContext, app) =>
|
|
{
|
|
app.Run(async (context) =>
|
|
{
|
|
await context.Response.WriteAsync("Hello World!");
|
|
});
|
|
})
|
|
.UseConsoleLifetime()
|
|
.Build();
|
|
|
|
var s = host.Services;
|
|
|
|
await host.RunAsync();
|
|
}
|
|
}
|
|
}
|