.NET 6 - Angular: ng serve not running until requesting page
See original GitHub issueWhen I run dotnet watch run
, it doesn’t run the ng-serve command until I access https://localhost:5001 in my browser.
With .NET 5 it used to start immediately. I have launchBrowser: false
in my launchSettings.json
.
.NET: 6.0.101 Angular: 12.2.2
(Sorry, I don’t know if this is a design-proposal).
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
angular - dotnet 6 Run "ng serve" independently
Net core 6 and I need to run angular independently from MSBuild to avoid restarting the angular server every time I rebuild.
Read more >ng serve
Option Description Value Type Default Value
‑‑hmr Enable hot module replacement. boolean false
‑‑host Host to listen on. string localhost
‑‑open Opens the url in default...
Read more >Create an ASP.NET Core app with Angular in Visual Studio
In this article, you learn how to build an ASP.NET Core project to act as an API backend and an Angular project to...
Read more >Angular TypeScript Tutorial in Visual Studio Code
Let's quickly run our Angular application by navigating to the new folder and typing ng serve to start the web server and open...
Read more >How to Publish Angular with ASP.NET Core
In this article, we are going to cover how to publish Angular SPA production files by configuring ASP.NET Core's project file.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Did you copy the code from here? It looks like .NET 5 or lower. https://stackoverflow.com/a/60598202/3717691
With .NET 6, there seems to no longer be a Startup.cs and the SPA is configured in .csproj, with these values:
Perhaps it can still be configured as you propose,
We did change this in 6.0 and we only start the proxy on first request. It is normally not an issue since the most common case is to open a page to the app, which triggers the launch. I have however filed an issue here to track the work needed to provide the option to start the proxy immediately instead of on first request.
I suspect the reason that we did it this way is because it made some async code to check if the server was already running easier to author.
We do not have plans to change it ourselves unless we receive significant feedback about it, but we would accept PRs as long as they roughly align to what is described in the referenced issue.
I am going to close this issue in favor of the other issue as it has all the context there.