11using Autofac . Extensions . DependencyInjection ;
2+ using Microsoft . AspNetCore ;
3+ using Microsoft . AspNetCore . Hosting ;
24using Microsoft . Extensions . Configuration ;
3- using Microsoft . Extensions . DependencyInjection ;
45using Microsoft . Extensions . Hosting ;
56using Ordering . BackgroundTasks . Extensions ;
6- using Ordering . BackgroundTasks . Tasks ;
77using Serilog ;
88using System . IO ;
9- using Microsoft . AspNetCore ;
10- using Microsoft . AspNetCore . Hosting ;
119
1210namespace Ordering . BackgroundTasks
1311{
1412 public class Program
1513 {
16- public static readonly string Namespace = typeof ( Program ) . Namespace ;
17- public static readonly string AppName = Namespace ;
14+ public static readonly string AppName = typeof ( Program ) . Assembly . GetName ( ) . Name ;
1815
1916 public static void Main ( string [ ] args )
2017 {
2118 CreateHostBuilder ( args ) . Run ( ) ;
2219 }
2320
24- public static IWebHost CreateHostBuilder ( string [ ] args ) =>
25- WebHost . CreateDefaultBuilder ( args )
21+ public static IHost CreateHostBuilder ( string [ ] args ) =>
22+ Host . CreateDefaultBuilder ( args )
23+ . UseServiceProviderFactory ( new AutofacServiceProviderFactory ( ) )
24+ . ConfigureWebHostDefaults ( webBuilder => webBuilder . UseStartup < Startup > ( ) )
2625 . ConfigureAppConfiguration ( ( host , builder ) =>
2726 {
2827 builder . SetBasePath ( Directory . GetCurrentDirectory ( ) ) ;
@@ -32,7 +31,6 @@ public static IWebHost CreateHostBuilder(string[] args) =>
3231 builder . AddCommandLine ( args ) ;
3332 } )
3433 . ConfigureLogging ( ( host , builder ) => builder . UseSerilog ( host . Configuration ) . AddSerilog ( ) )
35- . UseStartup < Startup > ( )
3634 . Build ( ) ;
3735 }
3836}
0 commit comments