Added SSL to Kestrel API server

This commit is contained in:
Fergal Moran
2017-12-15 19:36:11 +00:00
parent c62ec9d277
commit dc0c574ce9
8 changed files with 51 additions and 50 deletions

View File

@@ -2,27 +2,26 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace PodNoms.Api
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
namespace PodNoms.Api {
public class Program {
public static void Main (string[] args) {
BuildWebHost (args).Run ();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseKestrel(options =>
{
options.Limits.MaxRequestBodySize = 1073741824;
})
.Build();
public static IWebHost BuildWebHost (string[] args) =>
WebHost.CreateDefaultBuilder (args)
.UseStartup<Startup> ()
.UseKestrel (options => {
options.Listen (IPAddress.Any, 5000, listenOptions =>
listenOptions.UseHttps ("localhost.pfx"));
options.Limits.MaxRequestBodySize = 1073741824;
})
.Build ();
}
}
}