Skip to content

Instantly share code, notes, and snippets.

Last active February 28, 2021 23:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
using System.Net;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.ApplicationInsights;
using Notifier.Common.Extensions;
using Notifier.Common.Settings;
namespace Notifier.WebApi
public class Program
public static void Main(string[] args)
public static IHostBuilder CreateHostBuilder(string[] args) =>
.ConfigureAppConfiguration((hostBuilderContext, builder) =>
// Add configuration file, environment variables and command line arguments
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddUserSecrets(typeof(Program).Assembly, false)
.ConfigureLogging((context, builder) =>
Microsoft.Extensions.Logging.LogLevel.Information); // this will capture Info level traces and above.
.ConfigureWebHostDefaults(webBuilder =>
// Configure kestrel web server and call startup.
.ConfigureKestrel(serverOptions =>
serverOptions.Listen(IPAddress.Any, 8080);
// Needed because of using newtonsoft json
// (else there are performance issues in .net core 3)
serverOptions.AllowSynchronousIO = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment