public static IWebHost Create <TStartup>(string defaultBinding, AppStartupConfig startupConfig, Action <IWebHostBuilder> configAction) where TStartup : class { var httpBinding = startupConfig["http"] ?? defaultBinding; var builder = new WebHostBuilder() .UseKestrel() .UseUrls(httpBinding) .ConfigureServices(s => s.AddSingleton(startupConfig)) .UseStartup <TStartup>(); configAction(builder); var host = builder.Build(); return(host); }
public static IWebHost Create <TStartup>(string defaultBinding, string[] args, Action <IWebHostBuilder> configAction) where TStartup : class { var startupConfig = new AppStartupConfig(args); return(Create <TStartup>(defaultBinding, startupConfig, configAction)); }
public static IWebHost Create <TStartup>(string defaultBinding, AppStartupConfig startupConfig) where TStartup : class { return(Create <TStartup>(defaultBinding, startupConfig, _ => { })); }