更改launchSettings.json中的端口会显示“无法访问此站点”

时间:2019-02-19 15:39:28

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

我使用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"
      }
    }
  }
}

我在做什么错了?

1 个答案:

答案 0 :(得分:3)

extra_repr()中所述,您对IIS Express使用了不兼容的ssl端口。 代替"sslPort": 9995,而替换为端口号44300和44399。

  

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

相关问题