Help! My Web API project is acting up after restarting Visual Studio
I’m really confused right now. I was working on my ASP.NET Core 8 Web API project and everything was fine. But then I had to restart Visual Studio for some reason. Now when I try to run the project again, I’m getting a 404 error.
Here’s what I’m seeing in my browser:
This localhost page can't be found.
No webpage was found for the web address:
https://localhost:7281/swagger/index.html
HTTP ERROR 404
I didn’t change anything in my code or project settings. It’s like the restart just broke everything. Has anyone else run into this problem? Any ideas on how to fix it? I’m stuck and don’t know what to try next. Thanks for any help!
I’ve dealt with this frustrating issue before. One thing that often gets overlooked is the IIS Express configuration. Sometimes after a VS restart, it can get out of sync with your project settings.
Try this: right-click on your project in Solution Explorer, go to Properties, then Debug. Check if the App URL matches what you’re expecting. If not, update it and save.
Also, make sure your project is actually set as the startup project (right-click, Set as Startup Project). It’s easy to accidentally change this without realizing.
If those don’t work, try deleting the .vs folder in your solution directory. VS will recreate it when you reopen the solution, which can sometimes clear up weird issues like this.
Hope one of these helps you get back on track!
I’ve encountered similar issues with ASP.NET Core projects after Visual Studio restarts. One effective solution I’ve found is to check your launchSettings.json file in the Properties folder. Sometimes, the applicationUrl or launchUrl can get corrupted or reset unexpectedly. Verify that these settings are correct and match your project configuration. If they look off, adjust them manually and save the file. Then try running your project again. This simple step has resolved many mysterious 404 errors for me in the past. If that doesn’t work, you might want to consider regenerating your launchSettings.json file entirely.
hey man, ive seen this before. sometimes VS gets cranky after restarts. try cleaning ur solution n rebuilding. if that doesnt work, delete the bin and obj folders, then rebuild. those usually fix weird 404 errors. good luck!