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

相关推荐
豆芽脚脚8 小时前
MongoDB 导出和导入完整指南
数据库·mongodb
烧饼Fighting8 小时前
Mysql替换为瀚高数据库部分函数转换V4.5版本
数据库·mysql
上善若水_厚德载物9 小时前
Centos7 Mysql 5.7 读写分离
数据库·mysql
Mr__Miss9 小时前
Redis的持久化
数据库·redis·缓存
CCPC不拿奖不改名9 小时前
SQL基础(SQL小白教程):MySQL语句+环境一键搭建+面试习题
数据库·sql·计算机网络·mysql·oracle·面试·职场和发展
陈文锦丫9 小时前
JAVA面试
数据库·mysql
2501_9160088910 小时前
iOS 上架需要哪些准备,账号、Bundle ID、证书、描述文件、安装测试及上传
android·ios·小程序·https·uni-app·iphone·webview
sunfove10 小时前
将 Python 仿真工具部署并嵌入个人博客
开发语言·数据库·python
冰清-小魔鱼11 小时前
各类数据存储结构总结
开发语言·数据结构·数据库
深藏bIue12 小时前
MongoDB 4.4.30安装、数据迁移
数据库·mongodb