我想使用asp.net core 1.0在https上运行Kestrel
我试着跟随这个帖子 http://dotnetthoughts.net/how-to-setup-https-on-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功能.