Last active
January 19, 2021 04:10
-
-
Save mirsaeedi/806842e356b979bea213368343633da7 to your computer and use it in GitHub Desktop.
Register Hosted Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
CreateHostBuilder(args).Build().Run(); | |
} | |
public static IHostBuilder CreateHostBuilder(string[] args) => | |
Host.CreateDefaultBuilder(args) | |
.ConfigureWebHostDefaults(webBuilder => | |
{ | |
webBuilder.UseStartup<Startup>(); | |
}) | |
.ConfigureServices(services => | |
{ | |
services.AddHostedService<VideosWatcher>(); | |
services.Configure<HostOptions>(option => | |
{ | |
option.ShutdownTimeout = TimeSpan.FromSeconds(30); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment