If you wish to change the URL that your browser is directed to, when starting your new asp.net project you need to change your launch settings.
If you create a new project in Visual Studio you can get some boilerplate code for your launchSettings.json file (found at /Properties/launchSettings.json in your project), which will look like the following:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50221",
"sslPort": 44334
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast", //This decides the launch url
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
As you can see the launchUrl
in the above is weatherforecast
. What I would normally like my solution to open is swagger:
"TestWebApplication": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger", //This decides the launch url
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
It is as simple as that! Now when you press F5 you should be directed to the URL of your choice. Be aware that you may have multiple profiles in your project.