.net core 配置同时监听https和http

bash 复制代码
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://0.0.0.0:80"
      },
      "Https": {
        "Url": "https://0.0.0.0:443",
        "Certificate": {
          "Path": "certs/server.pfx"
         "Password":"xxxxxxxxx"
        }
      }
    }
  },
  "AllowedHosts": "*"
}

说明:

80为http默认端口

443为https默认端口

两个端口同时监听后,http收到的请求会自动跳转到https

0.0.0.0表示监听本机所有IP地址

certs/server.pfx 表示相对路径certs文件夹下的server.pfx文件

相关推荐
fzb5QsS1p3 小时前
MySQL 事务的二阶段提交是什么?
数据库·mysql
清风徐来QCQ6 小时前
Lombok/SSM/devTools
数据库
LaughingZhu6 小时前
Product Hunt 每日热榜 | 2026-04-05
前端·数据库·人工智能·经验分享·神经网络
2601_949814697 小时前
使用mysql报Communications link failure异常解决
数据库·mysql
搜佛说7 小时前
02-第2章-核心概念与架构
数据库·物联网·微服务·架构·边缘计算·iot
C'ᴇsᴛ.小琳 ℡8 小时前
高性能NoSQL
数据库·nosql
i220818 Faiz Ul9 小时前
动漫商城|基于springboot + vue动漫商城系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·动漫商城系统
iNgs IMAC9 小时前
redis 使用
数据库·redis·缓存
fe7tQnVan9 小时前
浅谈HTTP中Get与Post的区别
网络·网络协议·http
TDengine (老段)10 小时前
TDengine IDMP 可视化 —— 面板
大数据·数据库·人工智能·物联网·ai·时序数据库·tdengine