@@ -33,7 +33,7 @@ public static int Main(string[] args)
3333 try
3434 {
3535 Log . Information ( "Configuring web host ({ApplicationContext})..." , AppName ) ;
36- var host = CreateHostBuilder ( configuration , args ) . Build ( ) ;
36+ var host = CreateHostBuilder ( configuration , args ) ;
3737
3838 Log . Information ( "Applying migrations ({ApplicationContext})..." , AppName ) ;
3939 host . MigrateDbContext < CatalogContext > ( ( context , services ) =>
@@ -64,33 +64,29 @@ public static int Main(string[] args)
6464 }
6565 }
6666
67-
68- private static IHostBuilder CreateHostBuilder ( IConfiguration configuration , string [ ] args ) =>
69- Host . CreateDefaultBuilder ( args )
70- . ConfigureServices ( services => services . AddAutofac ( ) )
71- . ConfigureWebHostDefaults ( builder =>
67+ private static IWebHost CreateHostBuilder ( IConfiguration configuration , string [ ] args ) =>
68+ WebHost . CreateDefaultBuilder ( args )
69+ . UseConfiguration ( configuration )
70+ . CaptureStartupErrors ( false )
71+ . ConfigureKestrel ( options =>
7272 {
73- builder . CaptureStartupErrors ( false )
74- . UseConfiguration ( configuration )
75- . ConfigureKestrel ( options =>
73+ var ports = GetDefinedPorts ( configuration ) ;
74+ options . Listen ( IPAddress . Any , ports . httpPort , listenOptions =>
75+ {
76+ listenOptions . Protocols = HttpProtocols . Http1AndHttp2 ;
77+ } ) ;
78+ options . Listen ( IPAddress . Any , ports . grpcPort , listenOptions =>
7679 {
77- var ports = GetDefinedPorts ( configuration ) ;
78- options . Listen ( IPAddress . Any , ports . httpPort , listenOptions =>
79- {
80- listenOptions . Protocols = HttpProtocols . Http1AndHttp2 ;
81- } ) ;
82- options . Listen ( IPAddress . Any , ports . grpcPort , listenOptions =>
83- {
84- listenOptions . Protocols = HttpProtocols . Http2 ;
85- } ) ;
86-
87- } )
88- . UseStartup < Startup > ( )
89- . UseApplicationInsights ( )
90- . UseContentRoot ( Directory . GetCurrentDirectory ( ) )
91- . UseWebRoot ( "Pics" )
92- . UseSerilog ( ) ;
93- } ) ;
80+ listenOptions . Protocols = HttpProtocols . Http2 ;
81+ } ) ;
82+
83+ } )
84+ . UseStartup < Startup > ( )
85+ . UseApplicationInsights ( )
86+ . UseContentRoot ( Directory . GetCurrentDirectory ( ) )
87+ . UseWebRoot ( "Pics" )
88+ . UseSerilog ( )
89+ . Build ( ) ;
9490
9591 private static Serilog . ILogger CreateSerilogLogger ( IConfiguration configuration )
9692 {
0 commit comments