SOS Need Help! ASP.NET Core API & Angular Frontend Integration + Visual Studio Issues

Wa'ed Alsharea' - Sep 6 - - Dev Community

Hi everyone,

I'm working on an ASP.NET Core API backend and an Angular frontend project. While things work fine on my old machine, I’m facing a ton of issues after setting up the project on a new device. I’ve tried troubleshooting, but I’m really stuck.

Setup:
Backend: ASP.NET Core API (on http://localhost:5001)
Frontend: Angular (on http://localhost:5566)
Main Issues:
Can't Run API in Visual Studio:

The app runs fine on another PC, but on my new device, when trying to run the API from Visual Studio, I’m getting an HTTP 500 error. I’ve checked the Event Viewer, Serilog logs, and IISExpress logs, but none show clear errors.
When I run the API using dotnet run from the command line, the backend works, but I can’t use the Visual Studio debugger or hit breakpoints. The breakpoints show as unbound, and no symbols are loaded for the document.
Angular Frontend Can't Connect to API:

The Angular frontend is not able to hit the API when it is run using dotnet run. The API is accessible directly via Postman or browser, but when the frontend tries to make a request, it fails to connect to the backend API.
I’ve confirmed CORS is enabled and the environment.ts file in Angular points to http://localhost:5001/api/.
What I've Tried:
Checked that CORS is configured properly in the ASP.NET Core API.
Disabled HTTPS for the backend.
Made sure that both frontend and backend are running on separate ports (Angular: 5566, API: 5001).
Cleared Visual Studio’s ComponentModelCache.
Removed any suspicious launchSettings.json configurations.
Error Logs:
HTTP 500 error when running from Visual Studio, with no clear error in the logs.
Frontend cannot hit the backend API, no relevant logs are visible.
Additional Information:
This issue seems specific to this new device, as the project works perfectly fine on another PC.
The only way I can get the API to run on the new device is via dotnet run, but then I lose the debugging capabilities and the frontend-backend connection.
Questions:
Could this be an issue with environment configuration on the new PC? Something related to firewall, permissions, or dependencies?
Any ideas on what might be preventing the backend from running properly in Visual Studio while working fine with dotnet run?
What could be causing the Angular frontend to not hit the backend while using dotnet run?
I’ve been stuck on this for a while, and any advice would be really appreciated. Thanks in advance for your help! 🙏

. .
Terabox Video Player