I've followed several examples suggesting that to set my default route in an ASP.NET Core WebAPI project, I need to replace
app.UseMvc();
with
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}",
defaults: new { controller = "Traders", action = "Get" });
});
But when I run it defaults to localhost:54321/api/values
and it should default to localhost:54321/Traders
What's wrong?
As @tmg mentioned, do the following:
Right click your web project -> Select Properties -> Select the Debug tab on the left -> Then edit the 'Launch Url' field to set your own default launch url.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With