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

相关推荐
摘星编程1 分钟前
Vector数据库性能大比武:Pinecone、Weaviate、Chroma速度与准确率实测
数据库
CodeBlossom18 分钟前
Redis速通
数据库·redis·缓存
牛奶咖啡1327 分钟前
MySQL InnoDB Cluster 高可用集群部署与应用实践(下)
数据库·mysql·innodb cluster·mysql router·mysql路由的安装部署·mysql路由的测试·mgr组复制
姚远Oracle ACE3 小时前
解读Oracle AWR报告:Global Cache and Enqueue Services - Workload Characteristics
数据库·oracle
流星白龙3 小时前
【Qt】7.信号和槽_connect函数用法(2)
java·数据库·qt
Zzz 小生5 小时前
Claude Code学习笔记(四)-助你快速搭建首个Python项目
大数据·数据库·elasticsearch
nongcunqq8 小时前
abap 操作 excel
java·数据库·excel
rain bye bye9 小时前
calibre LVS 跑不起来 就将setup 的LVS Option connect下的 connect all nets by name 打开。
服务器·数据库·lvs
阿里云大数据AI技术10 小时前
云栖实录|MaxCompute全新升级:AI时代的原生数据仓库
大数据·数据库·云原生
不剪发的Tony老师10 小时前
Valentina Studio:一款跨平台的数据库管理工具
数据库·sql