R
R
Roman Rakzin2017-06-12 21:47:16
ASP.NET
Roman Rakzin, 2017-06-12 21:47:16

How to use https connection on Asp.Net core?

Please give examples how to set up an https connection on Asp.Net core (I don't use IIS- standard Kestrell in the project)
Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew K., 2017-06-12
@gdi32dll

You add the Microsoft.AspNetCore.Server.Kestrel.Https library to NuGet .
Then,

var host = new WebHostBuilder()
.UseKestrel(options =>
{
    // options.ThreadCount = 4;
    options.NoDelay = true;
    options.UseHttps("testCert.pfx", "testPassword");
    options.UseConnectionLogging();
})
.UseUrls("http://localhost:5000", "https://localhost:5001")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();

More

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question