public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
var store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
var certificate = store.Certificates.OfType()
.First(c => c.FriendlyName == "Ivan Yakimov Test-only Certificate For Server Authorization");
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder
.UseKestrel(options =>
{
options.Listen(System.Net.IPAddress.Loopback, 44321, listenOptions =>
{
var connectionOptions = new HttpsConnectionAdapterOptions();
connectionOptions.ServerCertificate = certificate;
listenOptions.UseHttps(connectionOptions);
});
})
.UseStartup();
});
}
}