Asp.net-Core

VSCode 在特定埠上啟動 ASP.NET Core 應用程序

  • October 10, 2016

從 launch.json,在特定埠上啟動 ASP.NET Core 的正確方法是什麼?例如,當我執行 .NET Core 應用程序 VS Code 時,將其託管在 localhost:5000 上,但我想將其託管在 localhost:5050 上。

提前致謝。

您可以通過環境變數對其進行配置ASPNETCORE_URLS

蘋果系統:

export ASPNETCORE_URLS=http://localhost:5050

視窗:

set ASPNETCORE_URLS=http://localhost:5050

或將其添加到 launch.json

 "env": {
   "ASPNETCORE_URLS": "http://localhost:5050"
 }

如果不想指定主機名,可以使用 * 代替

http://*:5050

引用自:https://stackoverflow.com/questions/39949752