Hosting--------------------------------------------------------------------------Setting up a Host :using Microsoft.AspNetCore.Hosting; public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() .Build(); host.Run(); } }var host = new WebHostBuilder() .UseKestrel() .Configure(app => { app.Run(async (context) => await context.Response.WriteAsync("Hi!")); }) .Build();host.Run();--------------------------------------------------------------------------Configuring a Host:new WebHostBuilder() .UseSetting("applicationName", "MyApp")Host Configuration ValuesApplication Name stringKey: applicationName. This configuration setting specifies the value that will be returned from IHostingEnvironment.ApplicationName.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Capture Startup Errors boolKey: captureStartupErrors. Defaults to false. When false, errors during startup result in the host exiting. When true, the host will capture any exceptions from the Startup class and attempt to start the server. It will display an error page (generic, or detailed, based on the Detailed Errors setting, below) for every request. Set using the CaptureStartupErrors method.new WebHostBuilder() .CaptureStartupErrors(true)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Content Root stringKey: contentRoot. Defaults to the folder where the application assembly resides (for Kestrel; IIS will use the web project root by default). This setting determines where ASP.NET Core will begin searching for content files, such as MVC Views. Also used as the base path for the Web Root setting. Set using the UseContentRoot method. Path must exist, or host will fail to start.new WebHostBuilder() .UseContentRoot("c:\\mywebsite")++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Detailed Errors boolKey: detailedErrors. Defaults to false. When true (or when Environment is set to “Development”), the app will display details of startup exceptions, instead of just a generic error page. Set using UseSetting.new WebHostBuilder() .UseSetting("detailedErrors", "true")++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Environment stringKey: environment. Defaults to “Production”. May be set to any value. Framework-defined values include “Development”, “Staging”, and “Production”. Values are not case sensitive. See Working with Multiple Environments. Set using the UseEnvironment method.new WebHostBuilder() .UseEnvironment("Development")++++++++++++++++++++++++++++++++++++++++++++++++++Server URLs stringnew WebHostBuilder() .UseUrls("http://*:5000;http://localhost:5001;https://hostname:5002")++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Startup Assembly stringnew WebHostBuilder() .UseStartup("StartupAssemblyName")++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Web Root stringnew WebHostBuilder() .UseWebRoot("public")public static void Main(string[] args){ var config = new ConfigurationBuilder() .AddCommandLine(args) .AddJsonFile("hosting.json", optional: true) .Build(); var host = new WebHostBuilder() .UseConfiguration(config) .UseKestrel() .Configure(app => { app.Run(async (context) => await context.Response.WriteAsync("Hi!")); }) .Build(); host.Run();}+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++dotnet run --urls "http://*:5000"var urls = new List () { "http://*:5000", "http://localhost:5001" };var host = new WebHostBuilder() .UseKestrel() .UseStartup () .Start(urls.ToArray());using (host){ Console.ReadLine();}