aspnetcore 3.1 angular project timeout on MacOS
See original GitHub issueDescribe the bug
Creating a new project using dotnet new angular -o my-app
does not create a working project. The project stalls on serving the angular frontend, resulting in timeouts.
To Reproduce
- Create a new angular project using the dotnet cli on MacOS (
dotnet new angular -o my-app
) - Change folder to the new project (
cd my-app
) - Build project (
dotnet build
) - Run project (
dotnet run
) - Open the provided url
What happens:
The request hangs for a while (depending on the spa.Options.StartupTimeout
set) and then fails.
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /Users/stuki/Code/temp/my-app
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.TimeoutException: The Angular CLI process did not start listening for requests within the timeout period of 0 seconds. Check the log output for error information.
at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout[T](Task`1 task, TimeSpan timeoutDelay, String message)
at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task`1 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
On closer inspection, dotnet build
does not even install the packages for the angular project.
What I expect to happen:
The backend should automatically start the frontend, and render the front page. dotnet build
should install npm packages for the frontend project
Further technical details
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
.NET Core SDKs installed:
2.1.700 [/usr/local/share/dotnet/sdk]
2.2.301 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
ASP.NET Core 3.1 Angular Web App builds and runs on ...
I did some investigation on this issue using my Mac. Turns out I can build and run the docker container successfully after some ......
Read more >The mystery of session timeout in ASP.NET Core 3.1 & 5
A .NET Core 3.1 web app authenticating with Azure AD has a nuget dependency on Microsoft.AspNetCore.Authentication.AzureAD.UI.
Read more >Can I use asp.net core 3.1 with angualr 11
Yes, you can use Asp.net core 3.1 with angular 11. You could refer the following steps to create a Asp.net core 3.1 application...
Read more >The Angular CLI process did not start listening for requests ...
System.TimeoutException: The Angular CLI process did not start listening for requests within the timeout period of 50 seconds. Check the log ...
Read more >Creating ASP NET Core 3.0 & Angular Project on macOS ...
In this video tutorial I will show you how to create an ASP.NET core 3.0 Project using Visual Studio IDE on macOS Catalina....
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
Based on feedback found in the Windows side of things, try this combined approach:
In package.json, under “scripts”, update the “start” script to:
echo Starting... && ng serve --host 0.0.0.0
Some folks seem to thing that adding the echo statement helps while others think that the --host attribute helps. I can attest to the first one helping at first, then the second one running with the baton when the first one quit making a difference! … and this is what happens when you involve Microsoft …
UPDATE: Worked once like a champ and then back to normal … I’m thinking @David-Ben-Mesecke is on to something! 😂
Sorry for the late reply. I ended up with a workaround that worked for me, simply save a ts file so that the compiler has to recompile the ts code and it works. Given it isn’t a problem that translates into the release, I have not bothered to find out why, yet I suspect that the second time around, it is using the ivy compiler while visual studio is trying to use the old compiler somehow. What is important for me is that this way I get it working and I really do not restart my debug sessions often enough for me to bother about the few extra seconds it takes to compile the code a second time.