parent
300b9cd90f
commit
669c06098b
|
|
@ -51,10 +51,6 @@ namespace SocialSample
|
||||||
{
|
{
|
||||||
loggerfactory.AddConsole(LogLevel.Information);
|
loggerfactory.AddConsole(LogLevel.Information);
|
||||||
|
|
||||||
//Configure SSL
|
|
||||||
var serverCertificate = LoadCertificate();
|
|
||||||
app.UseKestrelHttps(serverCertificate);
|
|
||||||
|
|
||||||
// Simple error page to avoid a repo dependency.
|
// Simple error page to avoid a repo dependency.
|
||||||
app.Use(async (context, next) =>
|
app.Use(async (context, next) =>
|
||||||
{
|
{
|
||||||
|
|
@ -337,7 +333,12 @@ namespace SocialSample
|
||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
.UseDefaultHostingConfiguration(args)
|
.UseDefaultHostingConfiguration(args)
|
||||||
.UseKestrel()
|
.UseKestrel(options =>
|
||||||
|
{
|
||||||
|
//Configure SSL
|
||||||
|
var serverCertificate = LoadCertificate();
|
||||||
|
options.UseHttps(serverCertificate);
|
||||||
|
})
|
||||||
.UseIISIntegration()
|
.UseIISIntegration()
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
@ -345,9 +346,9 @@ namespace SocialSample
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private X509Certificate2 LoadCertificate()
|
private static X509Certificate2 LoadCertificate()
|
||||||
{
|
{
|
||||||
var socialSampleAssembly = GetType().GetTypeInfo().Assembly;
|
var socialSampleAssembly = typeof(Startup).GetTypeInfo().Assembly;
|
||||||
var embeddedFileProvider = new EmbeddedFileProvider(socialSampleAssembly, "SocialSample");
|
var embeddedFileProvider = new EmbeddedFileProvider(socialSampleAssembly, "SocialSample");
|
||||||
var certificateFileInfo = embeddedFileProvider.GetFileInfo("compiler/resources/cert.pfx");
|
var certificateFileInfo = embeddedFileProvider.GetFileInfo("compiler/resources/cert.pfx");
|
||||||
using (var certificateStream = certificateFileInfo.CreateReadStream())
|
using (var certificateStream = certificateFileInfo.CreateReadStream())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue