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

相关推荐
一天八小时10 分钟前
计算机网络————(一)HTTP讲解
网络协议·计算机网络·http
qq_5298353515 分钟前
对计算机中缓存的理解和使用Redis作为缓存
数据库·redis·缓存
月光水岸New3 小时前
Ubuntu 中建的mysql数据库使用Navicat for MySQL连接不上
数据库·mysql·ubuntu
狄加山6753 小时前
数据库基础1
数据库
我爱松子鱼3 小时前
mysql之规则优化器RBO
数据库·mysql
chengooooooo3 小时前
苍穹外卖day8 地址上传 用户下单 订单支付
java·服务器·数据库
Rverdoser4 小时前
【SQL】多表查询案例
数据库·sql
Galeoto4 小时前
how to export a table in sqlite, and import into another
数据库·sqlite
人间打气筒(Ada)5 小时前
MySQL主从架构
服务器·数据库·mysql
leegong231115 小时前
学习PostgreSQL专家认证
数据库·学习·postgresql