微服务未在 LaunchSettings.JSON 设置的端口上启动
Microservice not Launching on Port Set by LaunchSettings.JSON
我正在尝试从 VS 调试 Microservice.When 运行,它在 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 服务器配置为 运行 5000 和 5001 上的 dotnet 核心应用程序。但是您可以通过在执行 exe 时提供命令行参数 --urls 来覆盖它。您可以在 Setting Up Kestrel
上阅读更多内容
替代默认端口的另一种方法是从 cmd 运行 它。
假设你的 exe 的名字是 webapi 然后覆盖默认端口打开 cmd 并转到 exe 所在的文件夹和 运行
webapi.exe --urls http://localhost:port。端口是 kestrel 将开始侦听的整数值。
我正在尝试从 VS 调试 Microservice.When 运行,它在 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 服务器配置为 运行 5000 和 5001 上的 dotnet 核心应用程序。但是您可以通过在执行 exe 时提供命令行参数 --urls 来覆盖它。您可以在 Setting Up Kestrel
上阅读更多内容替代默认端口的另一种方法是从 cmd 运行 它。
假设你的 exe 的名字是 webapi 然后覆盖默认端口打开 cmd 并转到 exe 所在的文件夹和 运行
webapi.exe --urls http://localhost:port。端口是 kestrel 将开始侦听的整数值。