[英]How to add SSl certificate to Kestrel in .Net core
I have a valid SSL certificate with a base64 format key.我有一个有效的 SSL 证书和 base64 格式密钥。 I have added the certificate using Nginx.
我已经使用 Nginx 添加了证书。 but not working.
但不工作。 routing is still hitting HTTP, not hitting HTTPS.network team suggest me to add a certificate directly to kestrel.
路由仍然命中 HTTP,而不是命中 HTTPS.network 团队建议我直接向红隼添加证书。
appsettings.json appsettings.json
"Kestrel": {
"https_port": 443,
"EndPoints": {
"Https": {
"Url": "https://*:7003"
}
}
},
"AllowedHosts": "*"
Try adding this to your appsettings.json
:尝试将此添加到您的
appsettings.json
:
"Kestrel": {
"Endpoints": {
"Https": {
"Url": "https://*:7003",
"Certificate": {
"Path": "path-to-your-pfx-file.pfx",
"Password": "password"
}
}
}
}
See the docs and the ASP.NET Core source code that loads the config.请参阅文档和加载配置的 ASP.NET 核心源代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.