加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 06:50:46 所属栏目:百科 来源:网络整理
导读:我想使用asp.net core 1.0在https上运行Kestrel 我试着跟随这个帖子 http://dotnetthoughts.net/how-to-setup-https-on-kestrel/ 但它并不适用于asp.net核心 它正在给出错误 app.UseKestrelHttps(证书) 错误是 Error CS1061 ‘IApplicationBuilder’ does no
我想使用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功能.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读