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

相关推荐
SelectDB2 分钟前
Apache Doris 中的 Data Trait:性能提速 2 倍的秘密武器
数据库·后端·apache
i***27954 分钟前
Spring boot 3.3.1 官方文档 中文
java·数据库·spring boot
TDengine (老段)25 分钟前
TDengine 日期函数 DATE 用户手册
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
q***656932 分钟前
PostgreSQL 中进行数据导入和导出
大数据·数据库·postgresql
一 乐41 分钟前
助农平台|基于SprinBoot+vue的助农服务系统(源码+数据库+文档)
前端·javascript·数据库·vue.js·ecmascript·springboot
NineData1 小时前
保姆级!Oracle→达梦零停机迁移攻略,5 步操作,业务零影响!
数据库·程序员
记得记得就1512 小时前
【Nginx 实战系列(一)—— Web 核心概念、HTTP/HTTPS协议 与 Nginx 安装】
前端·nginx·http
q***31832 小时前
MySQL---存储过程详解
数据库·mysql
E***U9452 小时前
C在物联网中的.NET Core
物联网·.netcore
q***42822 小时前
MySQL数据库误删恢复_mysql 数据 误删
数据库·mysql·adb