skip to Main Content

I`m using VS 2022 Professional 2022 (17.2.0).

I wanted to create a ASP.Net Core app with Angular in VS and used the Microsoft Tutorial for it. https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-asp-net-core-with-angular?view=vs-2022

When I want to start Multiple Project as once, only Angular CLI will start the ng start command, but the ASP.NET Core Project will never start.
When I disable the Angular Project inside, Multiple Startprojects, the .Net Core Console will start.

Creation started...
1>------ Build started: Project: ConverterBackend, Configuration: Debug Any CPU ------
2>------ Build started: Project: Converter, Configuration: Debug Any CPU ------
1>Analyzer tools are skipped to speed up the build. You can run the Build or Rebuild command to run the analyzer.
1>ConverterBackend -> C:OptimizationConverterConverterBackendbinDebugnet6.0ConverterBackend.dll
3>------ Deployment started: Project: Converter, Configuration: Debug Any CPU ------

Settings:

Multiple Projects Startup
Config Manager

.NET Debug Settings
Visual Studio Bar

proxy.conf.js

target: "https://localhost:7049",

launchSettings.json

"applicationUrl": "https://localhost:7049;https://localhost:5001",

I hope somebody has a Solution or run into the same Error once, cause I cant find anything about this.
Could this be an AV problem?

Solution:
If u ever run into this Problem Check Script Execution permissions and if the AV blocks something.

3

Answers


  1. I use two instances of VS open for this; each with a different start up project.

    Login or Signup to reply.
  2. You have to start the ASP.Net Core app. In there you should have a Startup Class.
    Go to Configure Services and add something like this:

    services.AddSpaStaticFiles(configuration => { configuration.RootPath = "WebUI"; });

    Then the Kestrel Server should start up with the SPA.

    Login or Signup to reply.
  3. I was also struggling with this and finally found a solution thanks to this user. It might not be viable for everyone since it requires a version downgrade but I’ll share it: I was using Node.js v18.12.1 (LTS at the time) (64-bit). I had installed it with nvm for Windows. With this set up, OP problem is reproduced.

    Then, I used nvm to switch to Node v16.18.1 (64-bit). With this change the frontend and backend run perfect as expected from the tutorial.

    Edit:

    Another solution to avoid the downgrade is keep using Node.js v18.12.1 and just add --host 0.0.0.0 to the start command in Angular package.json:

    "start": "ng serve --host 0.0.0.0 --ssl --ssl-cert %APPDATA%\ASP.NET\https\%npm_package_name%.pem --ssl-key %APPDATA%\ASP.NET\https\%npm_package_name%.key"
    

    This works but I can’t provide an explanation for why. But it requires adding a rule to the Windows firewall (you probably get a prompt asking you for permission).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search