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

相关推荐
Mr_Xuhhh1 天前
五种IO模型与非阻塞IO
数据库
拾零吖1 天前
数据库 - SQL
数据库·sql
不会c嘎嘎1 天前
MySQL -- 库的操作
数据库·mysql
陌上桑花开花1 天前
DBeaver常用配置
数据库
百***87441 天前
MySQL 查看有哪些表
数据库·mysql·oracle
曹牧1 天前
Oracle:查询当前正在等待执行的SQL语句
linux·数据库·oracle
_Kafka_1 天前
在 Oracle Data Guard 环境中,手工将备库(Standby)切换为主库(Primary)
数据库·oracle
百***24131 天前
oracle使用PLSQL导出表数据
数据库·oracle
cqsztech1 天前
ORACLE 11g 在线修改数据文件路径
数据库·oracle
为什么要做囚徒1 天前
Oracle跨用户表授权+同义词创建的标准脚本模板
数据库·oracle