skip to Main Content

This localhost page can’t be found webpage was found for the web address: http://localhost:5254/

HTTP ERROR 404

Program.cs

launchsettings.json

2

Answers


  1. Chosen as BEST ANSWER

    solution: add localhost/swagger,
    vscode doesn't show swagger url on startup


  2. This localhost page can’t be found webpage was found for the web address: http://localhost:5254/ HTTP ERROR 404

    In ASP.NET CORE WebAPI project, it does not configure default route or serve default document for root URL path, which cause above issue.

    If you check the code of your API controller, you might find that the routes like below are defined.

    [ApiController]
    [Route("[controller]")]
    

    or

    [ApiController]
    [Route("api/[controller]")]
    

    To access specific endpoint, please check the actual route defined on that endpoint, you may need to include [controller] and [action] info in URL while you make request(s).

    For more information about routing, please check: https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/routing?view=aspnetcore-6.0#attribute-routing-for-rest-apis

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search