예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
 public static IWebHost Create <TStartup>(string defaultBinding, AppStartupConfig startupConfig) where TStartup : class
 {
     return(Create <TStartup>(defaultBinding, startupConfig, _ => { }));
 }