Search code examples
webapi

Why I am getting error running webapi from vscode?


I created a new Web API in visual studio code by running this:

dotnet new webapi -n API -controllers

and then pressed ctrl + shift + P and typed build to generate assets for build and debug. now I have the below 2 files:

launchsettings.js and launch.js

why I am getting error when trying to run the visual studio code for new webapi.

I installed iisexpress extention and still not working.

when I run:

dotnet run

I am getting 404 error.


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


Solution

  • Since it is the Web API, you should try requesting the exact endpoint in your webapi followed by the mentioned URL.