Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

My ASP.NET core app startup route is set as:

/api/values

I want to change this startup route to be:

/

Looking through the documentation there is lots of specification on route constraints but I'm not sure I see how to set the route that gets run on startup...

It's calling the wrong controller on startup. If I remove the controller (ValueController), I get a 404. Where is it specified to use this controller at runtime?

I'm seeing hope in the hidden launchSettings.json but editing

http://localhost:5000/api/value

to

http://localhost:5000/

does not help

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
294 views
Welcome To Ask or Share your Answers For Others

1 Answer

Adam Weitzman is right, but you can also switch it using Visual Studio's GUI.

  1. Right-click on project in Solution Explorer
  2. Click Properties
  3. Go to Debug tab
  4. Check the Launch URL checkbox and set the URL you want. Leave the text box empty to launch the root URL

Launch URL setting


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...