I am trying to change http://localhost:5001/api/values route but the program is stuck this url.
I read this solutions
How to change the default controller and action in ASP.NET Core API?
How to redirect root to swagger in Asp.Net Core 2.x?
https://medium.com/quick-code/routing-in-asp-net-core-c433bff3f1a4
Everyone write same thing but not work for me.
My launchSetting.json file is
{ "$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54650",
"sslPort": 44382
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ShoppingBasketAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
I tried to change app.UseMvc();
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-2.2
this is also not working.Where does api/values come from? I can't figure out .
My controller attribute route is
[Route("api/[controller]/[action]")]