【发布时间】:2021-09-08 21:14:50
【问题描述】:
我突然无法配置监听的端口。现在默认是踢:
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
我想使用 6677。
程序.cs:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder
.UseStartup<Startup>()
.UseUrls("http://localhost:6677/")
.UseKestrel();
});
launchsettings.json:
{
"profiles": {
"MyApi": {
"commandName": "Project",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "local"
},
"applicationUrl": "https://localhost:6677;http://localhost:6677"
}
}
}
我可以确认我正在使用正确的配置文件,因为正在解析“本地”。
我做了什么?
【问题讨论】:
标签: asp.net-core asp.net-core-webapi asp.net-core-3.1 kestrel-http-server