Javascriptservices: ASP.NET Core 2.1 Preview 2 Angular CLI App is not starting on debug mode

Created on 23 Apr 2018  路  9Comments  路  Source: aspnet/JavaScriptServices

I have created an app selecting template angular with asp.net core 2.1 preview2-final on visual studio 2017 Version 15.6.6 . It runs gracefully without debug mode but does not run anyway on debug mode..It continuously showing the following exception :

TimeoutException: The Angular CLI process did not start listening for requests within the timeout period of 50 seconds. Check the log output for error information.
Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout<T>(Task<T> task, TimeSpan timeoutDelay, string message)
TimeoutException: The Angular CLI process did not start listening for requests within the timeout period of 50 seconds. Check the log output for error information.
Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout<T>(Task<T> task, TimeSpan timeoutDelay, string message)
Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task<Uri> baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s)
Microsoft.AspNetCore.Builder.SpaProxyingExtensions+<>c__DisplayClass2_0+<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

I have tried with changing the startup timeout value as follows but no luck:

app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.Options.StartupTimeout = new TimeSpan.FromSeconds(120);
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });

Most helpful comment

Refreshing (F5) the page solved the problem and it works fine.

All 9 comments

I have the same issue using 15.7 Preview 4. If I run my project from the command line, using dotnet run, the website loads up but the "Fetch data" page is broken (always "Loading...").

+1
Just setup a new Angular dotnet core 2.1 app
running 'dotnet run' from cmd works fine!
But F5 in Visual Studio 2017 (and VS 2017 Preview) doesn't work and always results in the error above.
The console however shows that the 'ng serve' command runs successfully

Problem is fixed in ASP.NET Core 2.1 RC..Now everything is okay and working as expected.

You are right switching from '2.1.0-preview2-final' to '2.1.0-rc1-final' fixed the problem

Yes, it was fixed in the RC release.

Using ASP.NET Core 2.1, issue still exists

Using ASP.NET Core 2.1 issue still exists

Refreshing (F5) the page solved the problem and it works fine.

Issues still exists, however just waiting it out and the angular builds, from my end the issue seems to be caused by the build order. What I mean is that the Server side code builds faster than the angular code, hence after waiting a second or two the error disappears

Was this page helpful?
0 / 5 - 0 ratings