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

相关推荐
5***E6854 小时前
【SQL】写SQL查询时,常用到的日期函数
数据库·sql
天宇&嘘月4 小时前
Nginx的https搭建
网络·nginx·https
rainmanqqst4 小时前
C#Netcore支持Https
网络协议·http·https·c#
遇见火星4 小时前
CentOS7 通过源码安装 Redis
数据库·redis·缓存
Mr.朱鹏4 小时前
RocketMQ安装与部署指南
java·数据库·spring·oracle·maven·rocketmq·seata
Coder-coco4 小时前
个人健康管理|基于springboot+vue+个人健康管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·mysql·论文
K哥11254 小时前
【9天Redis系列】基础+全局命令
数据库·redis·缓存
s***46984 小时前
【玩转全栈】----Django模板语法、请求与响应
数据库·python·django
f***R85 小时前
redis分页查询
数据库·redis·缓存
g***72705 小时前
【mysql】导出导入mysql表结构或者数据
数据库·mysql