Reputation: 43
This localhost page can't be found webpage was found for the web address: http://localhost:5254/
HTTP ERROR 404
Upvotes: 3
Views: 14194
Reputation: 57
You should add /swagger/index.html
to the link:
http://localhost:5254/swagger/index.html
Upvotes: 3
Reputation: 43
solution: add localhost/swagger,
vscode doesn't show swagger url on startup
Upvotes: 1
Reputation: 27825
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
Upvotes: 4