API will not start

DotNetGuy-3168 1 Reputation point
2022-05-23T06:35:37.44+00:00

https://learn.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.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,199 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Shapeshifter 36 Reputation points
    2022-10-30T17:40:05.323+00:00

    I had the same problem. A guy on S.O. suggested downgrading nodejs to v16.15 (an old LTS). I also had to rename c/program files/nodejs to be able to 'NVM use' this, but on retrying this tutorial app, it then worked as it should.

    tbh, I remember seeing a warning when installing angular that the version of node I was using (18.x) wasn't supported, so can't complain.

    1 person found this answer helpful.

  2. Zhi Lv - MSFT 32,016 Reputation points Microsoft Vendor
    2022-05-24T05:59:04.8+00:00

    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

    0 comments No comments

  3. Scott Oviedo-Atkinson 0 Reputation points
    2023-02-11T06:07:38.2033333+00:00

    I'm currently experiencing the same issue, gone through the steps listed in the tutorial several time, yet the api refuses to run when starting the project within Visual Studio

    I'm using chrome, and the angular version is 15 according to package.json.

    Any solution?

    0 comments No comments