Access IServiceProvider when using generic IHostBuilder
问题 I'm using IHostBuilder in a .NET Core 2.1 console application. Main looks like this: public static async Task Main(string[] args) { var hostBuilder = new HostBuilder() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureServices(services => { // Register dependencies // ... // Add the hosted service containing the application flow services.AddHostedService<RoomService>(); }); await hostBuilder.RunConsoleAsync(); } } Before, with IWebHostBuilder , I had the Configure()