简体   繁体   English

微服务未在 LaunchSettings.JSON 设置的端口上启动

[英]Microservice not Launching on Port Set by LaunchSettings.JSON

I'm trying to debug a Microservice.When running from VS,it launches in the port set in LaunchSettings.json ,but when running using the exe , all microservices starts from port 5001 .我正在尝试调试微服务。当从 VS 运行时,它在LaunchSettings.json设置的端口中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"
      }
    }
  }
}

Kestrel server is configured to run dotnet core app on 5000 and 5001. But you can override it by providing command line argument --urls while executing exe. Kestrel 服务器配置为在 5000 和 5001 上运行 dotnet 核心应用程序。但是您可以通过在执行 exe 时提供命令行参数 --urls 来覆盖它。 You can read it more on Setting Up Kestrel您可以在设置 Kestrel上阅读更多内容

Alternate way to override default port is to run it from cmd.覆盖默认端口的另一种方法是从 cmd 运行它。 Suppose your exe's name is webapi then to override default port open cmd and go to the folder where exe is located and run假设你的 exe 的名字是 webapi 然后覆盖默认端口 open cmd 并转到 exe 所在的文件夹并运行
webapi.exe --urls http://localhost:port . webapi.exe --urls http://localhost:port Port is integer value where kestrel will start listening.端口是 kestrel 将开始侦听的整数值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更改launchSettings.json中的端口会显示“无法访问此站点” - Changing port in launchSettings.json gives “This site can’t be reached” Visual Studio for Mac 忽略launchSettings.json - Visual Studio for Mac Ignoring launchSettings.json Launchsettings.json 不是使用 dotnet new 创建的 - Launchsettings.json not created using dotnet new launchSettings.json 文件打开错误的 URL - launchSettings.json file opens wrong URL launchSettings.json 和 appSettings.json 是如何工作的? - how do launchSettings.json and appSettings.json work? 如何在 linux 上的 launchsettings.json 中引用环境变量 - How to reference environment variables in launchsettings.json on linux 是否可以在 launchsettings.json 中将 executablePath 指定为相对路径? - Is it possible to specify executablePath as a relative path in launchsettings.json? 在launchSettings.json中引用环境变量的值 - Referring to environment variable's value inside launchSettings.json 根据构建配置选择launchSettings.json配置文件 - Choose launchSettings.json profile based on build configuration 来自 launchsettings.json 的环境变量正在测试中使用吗? - Environment variables from launchsettings.json are being used in tests?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM