代码之家  ›  专栏  ›  技术社区  ›  techno

Microservice未在LaunchSettings设置的端口上启动。JSON

  •  0
  • techno  · 技术社区  · 4 年前

    我正在调试一个微服务。从VS运行时,它将在中设置的端口中启动 LaunchSettings.json ,但在使用 exe ,所有微服务都从端口启动 5001

      "$schema": "http://json.schemastore.org/launchsettings.json",
      "iisSettings": {
        "windowsAuthentication": false, 
        "anonymousAuthentication": true, 
        "iisExpress": {
          "applicationUrl": "http://localhost:5004",
          "sslPort": 44345
        }
      },
      "profiles": {
        "IIS Express": {
          "commandName": "IISExpress",
          "launchBrowser": true,
          "launchUrl": "api/values",
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        },
        "myapp": {
          "commandName": "Project",
          "launchBrowser": true,
          "launchUrl": "api/values",
          "applicationUrl": "http://localhost:5004",
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        }
      }
    }
    
    0 回复  |  直到 4 年前
        1
  •  1
  •   anand shukla    4 年前

    Kestrel服务器配置为在5000和5001上运行dotnet core应用程序。但您可以通过在执行exe时提供命令行参数URL来覆盖它。你可以在 Setting Up Kestrel

    替代默认端口的另一种方法是从cmd运行它。 假设您的exe名为webapi,然后覆盖默认端口open cmd并转到exe所在的文件夹并运行
    webapi。exe--URLhttp://localhost:port 。端口是kestrel开始监听的整数值。