IIS Express 端口 - 文件中的多个端口

IIS Express Ports - Multiple Ports in File

愚蠢的问题,但我找不到它。为什么 IIS Express 使用 2 个端口(下面的示例文件)。

其次,在此练习中,当我被要求设置应用程序时,它引用了 3007,我无法访问它。 https://docs.microsoft.com/en-us/learn/modules/identity-application-types/5-exercise-web-apps-call-apis

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

iisSettings在运行ning VS2019或其他visual studio版本IDE时使用

IdentityWeb(peojectname) 用于 dotnet 命令行。

官方文档: Development and launchSettings.json

这些只是项目根据运行环境的不同配置,不用纠结

测试步骤。


  1. 在vs2019中删除iisSettings,然后更改属性,然后检查launchSettings.json文件。

    之前删除的ssl端口是44316,然后我们删除。更改属性后,它生成了新的 ssl 端口。

    现在,我们可以运行项目(我们需要重启IDE [vs2019]),它工作正常。


  1. 修改IdentityWeb中的applicationUrl。

    在项目文件夹中打开 cmd 或 powershell。