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

前端之家收集整理的这篇文章主要介绍了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功能.

原文链接:https://www.f2er.com/netcore/94423.html

猜你在找的.NET Core相关文章