Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kestrel on https with asp.net core 1.0

I want to run Kestrel on https with asp.net core 1.0 I tried to follow this post http://dotnetthoughts.net/how-to-setup-https-on-kestrel/

But it doesn't work with asp.net core

It is giving the error at

app.UseKestrelHttps(certificate)

The error is

Error CS1061 'IApplicationBuilder' does not contain a definition for 'UseKestrelHttps' and no extension method 'UseKestrelHttps' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?)

like image 453
MAQ Avatar asked Aug 01 '16 10:08

MAQ


People also ask

What is ASP NET Core Kestrel?

Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the web server that's included by default in ASP.NET Core project templates. Kestrel is supported on all platforms and versions that .NET Core supports.

How do I configure Kestrel to use HTTPS?

Configuring HTTPS for Kestrel. Kestrel is the web server that is used by default with ASP.NET Core. To add HTTPS support to Kestrel add the Microsoft.AspNetCore.Server.Kestrel.Https package as a dependency.

How do I create a kestrel project in Visual Studio?

If you are running Windows and have the full version of Visual Studio you can just do File -> New Project, select .Net Core, ASP.NET Core Web Application and then select Empty. Kestrel is the web server that is used by default with ASP.NET Core.

Is Kestrel supported on macOS?

In this article. Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the web server that's included and enabled by default in ASP.NET Core project templates. †HTTP/2 will be supported on macOS in a future release. Kestrel is supported on all platforms and versions that .NET Core supports.


1 Answers

That article seems to be about ASP.NET 5 RC1. According to this post, in ASP.NET Core, .UseKestrelHttps() has been replaced with options.UseHttps(), for example:

var host = new WebHostBuilder()
    .UseKestrel(options => {
        options.UseHttps(new X509Certificate2(...));
    })

You need to add Microsoft.AspNetCore.Server.Kestrel.Https to your project to get the UseHttps functionality.

like image 174
svick Avatar answered Oct 05 '22 22:10

svick