【发布时间】:2019-02-18 11:02:59
【问题描述】:
在 ASP.NET Core 2.1 I 应用程序 appSettings 文件中,我有以下内容:
"Kestrel": {
"Certificates": {
"Default": {
"Path": "localhost.pfx",
"Password": "1234"
}
}
}
我使用 dotnet 命令创建了证书:
dotnet dev-certs https -ep "localhost.pfx" -p 1234
我将 localhost.pfx 文件沿 appSettings 文件复制到项目根目录。
当我在http://localhost:5000 上运行项目时,它会被重定向到https://localhost:5001。
但是,我收到浏览器错误,提示连接不安全并要求我添加异常。
我做错了什么?
【问题讨论】:
-
你用的是什么浏览器?
-
我试过火狐和谷歌浏览器
-
您是否尝试过在
dev-certs命令中使用--trust标志?dotnet dev-certs https -ep "localhost.pfx" -p 1234 --trust. -
为了真正受到信任,必须将自签名证书添加到 Windows 中的信任证书存储区(这是
--trust参数实现的),但您也可以这样做手动。但是,这只影响依赖于 Windows 受信任证书存储的浏览器,据我所知,只有 IE、Edge 和 Chrome。尤其是 Firefox,没有,所以您仍然需要在 Firefox 中添加手动异常。
标签: asp.net-core asp.net-core-2.1