【问题标题】:Changing port in launchSettings.json gives "This site can’t be reached"在 launchSettings.json 中更改端口会给出“无法访问此站点”
【发布时间】:2019-02-19 15:39:27
【问题描述】:

我使用 VS2017 创建了一个空的 asp.net 核心应用程序。我唯一更改的是 launchSettings.json 文件中的 "sslPort": 属性。 当我单击运行 IIS Express chrome 时,会打开 url https://localhost:9995/ 并给出 This site can't be reached The connection was reset. 错误

我的 launchSettings.json 如下

{
  "iisSettings": {
    "windowsAuthentication": false, 
    "anonymousAuthentication": true, 
    "iisExpress": {
      "applicationUrl": "http://localhost:39566",
      "sslPort": 9995
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "JccWeb2": {
      "commandName": "Project",
      "launchBrowser": true,
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

我做错了什么?

【问题讨论】:

    标签: c# asp.net .net .net-core


    【解决方案1】:

    docs 中所述,您使用的 ssl 端口与 IIS Express 不兼容。 替换为 44300 到 44399 之间的端口号,而不是 "sslPort": 9995

    如果您想测试对您网站的 SSL 访问,您可以使用 IIS Express 执行此操作,方法是使用 44300 和 44399 之间的 SSL 端口并使用 IIS Express 自签名证书。当您的网站在 IIS Express 下启动时,尝试将 SSL 与此范围之外的端口一起使用会导致 URL 绑定失败。

    【讨论】:

    • 你是对的。必须将端口更改为上述范围内的一个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-03
    • 2017-03-16
    • 1970-01-01
    • 2021-04-09
    • 1970-01-01
    • 1970-01-01
    • 2017-12-07
    相关资源
    最近更新 更多