【问题标题】:Problem with project running on wrong localhost项目在错误的本地主机上运行的问题
【发布时间】:2021-10-26 07:42:32
【问题描述】:

我有一个 Web API 项目 (MapBackend)。我想在 MapBackend-applicationUrl (https://localhost:5001) 启动项目,但它启动 ssl 端口 (https://localhost:44365/)。所以这个项目行不通。我该如何解决这个问题?

证明它不起作用: Proof 1 Proof 2

这是我的 launchSettings.json 文件:

{
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:43928",
      "sslPort": 44365
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "MapBackEnd": {
      "commandName": "Project",
      "dotnetRunMessages": "true",
      "launchBrowser": true,
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

【问题讨论】:

    标签: asp.net asp.net-core


    【解决方案1】:

    从 Visual Studio 下拉框中选择 Kestrel 配置:

    在您的情况下,“IIS Express”下的名称将是“MapBackEnd”

    【讨论】:

      【解决方案2】:

      检查你的 appsettings.json 文件,看看你里面是否有这样的东西:

      "Kestrel": {
        "EndPoints": {
          "Http": {
            "Url": "http://*:5000"
          }
        }
      }
      

      从 VisualStudio 启动时,您的应用程序将在此端口上运行。

      【讨论】:

      • 我的 appsettings.json 文件中没有这部分。我加了,可惜还是不行
      猜你喜欢
      • 2014-03-02
      • 1970-01-01
      • 2014-12-04
      • 1970-01-01
      • 1970-01-01
      • 2017-05-04
      • 2018-10-16
      • 2021-10-19
      • 2020-04-20
      相关资源
      最近更新 更多