C
C#16mo ago
M B V R K

❔ How to set a custom start URL for an API from launch.json (VS Code)

I'm working on an ASP.Net core 7 web API, I use VS Code, in the launch.json file I have this configuration:
"name": "Backend API",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Web.API/bin/Debug/net7.0/Web.API.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Web.API",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
"name": "Backend API",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Web.API/bin/Debug/net7.0/Web.API.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Web.API",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
When I start the app, it goes directly to http://localhost:5272/, but I want it to directly go to http://localhost:5272/Swagger. Please does anyone here knows how to do it ? Massive thanks in advance <3
1 Reply
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.