question

DotNetGuy-3168 avatar image
0 Votes"
DotNetGuy-3168 asked ZhiLv-MSFT answered

API will not start

https://docs.microsoft.com/en-us/visualstudio/javascript/tutorial-asp-net-core-with-angular?view=vs-2022

I followed those steps with precision and for some reason the API DOS dialog never runs. The Angular dialog runs fine. When i nagivate to the page it says: "

Weather forecast
This component demonstrates fetching data from the server.

Loading... Please refresh once the ASP.NET backend has started. See https://aka.ms/jspsintegrationangular for more details.

Why does the .NET Core API not start? I'm using VS Community 2022 and Angular 13.

When I go into C:\Code\ASP.NET CRUD with Angular\API\angular\angularAPI\bin\Debug\net6.0 and manually start the API everything works. But, I shouldn't have to manually kick it off.

dotnet-aspnet-core-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ZhiLv-MSFT avatar image
0 Votes"
ZhiLv-MSFT answered

Hi @DotNetGuy-3168,

Why does the .NET Core API not start? I'm using VS Community 2022 and Angular 13.

Check the "Set the startup project" part, here we need to set the Multiple startup projects, and move the backend API project above the frontend, so that it starts up first

Then, when start the project, we need to use the port number in the launchSettings.json file in the ASP.NET Core (API) project and the proxy.conf.js file for the Angular project.

204926-image.png

Besides, please also check the Set the project properties part. To the Asp.net core BackEnd (API) project, go to the Debug menu and select Open debug launch profiles UI option. Uncheck the Launch Browser option.

According to the document, I create a sample the result as below:

204928-image.png

Everything works well, you can try again. If still not working, is there any error in the Command window?


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Best regards,
Dillion


image.png (185.0 KiB)
image.png (265.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.