c# – Kestrel在https与asp.net core 1.0

我想使用asp.net core 1.0在https上运行Kestrel
我试着跟随这个帖子 http://dotnetthoughts.net/how-to-setup-https-on-kestrel/

但它并不适用于asp.net核心

它正在给出错误

app.UseKestrelHttps(证书)

错误是

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功能.

相关文章

本文将从上往下,循序渐进的介绍一系列相关.NET的概念,先从...
基于 .NET 的一个全新的、好用的 PHP SDK + Runtime: Pe...
.NET 异步工作原理介绍。
引子 .NET 6 开始初步引入 PGO。PGO 即 Profile Guided Opti...
前言 2021/4/8 .NET 6 Preview 3 发布,这个版本的改进大多来...
前言 开头防杠:.NET 的基础库、语言、运行时团队从来都是相...