前言
近期想要用 Cli 執行專案遇到 Port 不是自己當初設定的Port,因此想要記錄一下。
dotnet run
dotnet run 有含 –urls 參數可以將網址設定進去,如下方範例。
1  | dotnet run --urls=http://localhost:5000  | 
補充 launchSettings 使用方式
可以透過 Properties > launchSettings.json 進行設定並執行,如下方範例。
1  | {  | 
1  | dotnet run --launch-profile "WebApplication1"  | 
dotnet watch
dotnet watch 與run 不同,沒有一個參數可以設定Port有關的參數,因此需要透過 Program.cs案進行設定。
1  | builder.WebHost.ConfigureKestrel(options =>  | 
1  | dotnet watch  | 
補充 launchSettings 使用方式
如果想要依照 launchSettings.json 進行設定,可以透過下方方式進行設定。
1  | {  | 
1  | dotnet watch run --launch-profile "test"  | 
`
本部落格所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議。轉載請註明來自 John Conte Blog!
 評論
DisqusGitalk






![[筆記] Synology 創建 Docker datalust/seq 環境](/image/20250810_08-15-28.png)
![[DevOps] 創建一個 docker agent](/image/20250810_08-16-08.png)