[英]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.