.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文件

相关推荐
徐同保3 小时前
python异步函数语法解析,async with ... as ...语法解析
数据库·python·oracle
是梦终空3 小时前
计算机毕业设计266—基于Springboot+Vue3的共享单车管理系统(源代码+数据库)
数据库·spring boot·vue·课程设计·计算机毕业设计·源代码·共享单车系统
a285283 小时前
nginx的重定向
大数据·数据库·nginx
蒂法就是我4 小时前
mysql主键索引和其他索引区别在哪里?
数据库·mysql
eWidget4 小时前
数据可视化进阶:Seaborn 柱状图、散点图与相关性分析
数据库·python·信息可视化·kingbase·数据库平替用金仓·金仓数据库
X54先生(人文科技)4 小时前
20260211_AdviceForTraditionalProgrammers
数据库·人工智能·ai编程
橘子136 小时前
redis持久化
数据库·redis
weixin_421994786 小时前
互联网与 Web 应用简介
.net·.netcore
jghhh018 小时前
LT喷泉码编解码的MATLAB实现
数据库·算法·matlab