https 上的红隼 asp.net 核心 1.0

Kestrel on https with asp.net core 1.0

我想 运行 Kestrel on https with asp.net core 1.0 我试着按照这个 post http://dotnetthoughts.net/how-to-setup-https-on-kestrel/

但它不适用于 asp.net 核心

它在

给出了错误

app.UseKestrelHttps(certificate)

错误是

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?)

那篇文章似乎是关于 ASP.NET 5 RC1。根据this post,在ASP.NET Core中,.UseKestrelHttps()被替换为options.UseHttps(),例如:

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

您需要将 Microsoft.AspNetCore.Server.Kestrel.Https 添加到您的项目中才能获得 UseHttps 功能。