-
Notifications
You must be signed in to change notification settings - Fork 10.3k
2000ms delay serving any SPA files in development environment #17607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@penfold thanks for contacting us. That is probably normal and expected if the application is running in development, as React/Angular files need to be compiled by the dev-server. @SteveSandersonMS do you have any further thought? |
@penfold can you please confirm that this delay happens only on the first request after modifying code or starting the server? |
@mkArtakMSFT It is for every file requested from the SPA via the development proxy process. It is for all file types including image resources. Watching the debug output the typescript compilation is not the cause. I can see the expected extended response time for the first request during the building of the Angular project. The API controller endpoints do not show the delay. I'm just not sure how to start debugging this type of issue. Thanks, |
I've run the SPA without using VS - just via 'ng s'. There is no delay when loading in this scenario. This is what is pointing me to Visual Studio 16.4 and the SPA Service Extensions (v3.1.0). |
@penfold Could you try and collect a trace with https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace? |
@penfold thanks for the trace. I believe you are using application insights in your app during development and that seems to be where the app is spending most of the time? Could you disable app insights and check if that solves the issue? |
@javiercn I've removed AppInsights and set the logging for 'Microsoft' to none. This looks like it has removed a lot of noise in the tracing (see new trace). Still seeing the 2 second delays. |
Sorry, wrong trace file. |
From what I can tell, this is external (unmanaged code) code Do you get a 2 second delay on the first request for the file or on every single one of them. Can you also make sure to include the sever logs at debug level? See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1#event-source-provider on how to do so. |
I'm not totally sure what I'm doing here... I've added the following:
I'm not sure that to put as XXXX for 'server logs'? Also, do I need to specify a provider on the trace commandline? |
It seems like you are using the old webhost instead of the new generic host. I thought we were looking at an out of the box application, am I wrong here? Could you check with a brand new 3.1 app and see if it happens there? That way we can look what's different. The event source logger should be enabled by default in the out of the box templates (it's enabled by default on the webhost). You need to pass |
I've looked at the new trace. I'm not sure if we are capturing the Debug logs, but I can't see any logging related to the SPA apps. I'm not sure how to dig deeper into this. I'll ask a couple of folks. @SteveSandersonMS do we have any logging on SPAs? @davidfowl Is there a better way to do an investigation than the trace from dotnet trace? |
@javiercn Nothing specific. The proxying code is at https://github.com/aspnet/AspNetCore/blob/master/src/Middleware/SpaServices.Extensions/src/Proxying/SpaProxy.cs. |
Just to add, I'm having crazy delays with the proxy too... Especially with a bigger app that I've just converted from AngularJS to Angular 9. Often the .NET proxy server will just throw a timeout, while I can instantly access the Angular server by just visiting the port that it was launched on. |
I just noticed that my Is there perhaps some issue with the proxy limiting transfers? I know that Kestrel on Linux had some limitation in place. |
I created #17925 regarding error messaging... But some tips from stuff I've listed there: .NET never lists errors related to Compilation errors will appear in the .NET command prompt, but they still result in a generic "timeout" exception from .NET's HTTP response. |
It looks like #18062 may be related. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
A temporary fix when running into this is to change the start script of the package.json of the app under development to: This might cause some side effects when moving to machines which only have ipv4 or use a different resolve order. |
This is a dupe of #22769 We recommend following the approach described there to avoid this issue |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
In the development environment, I'm seeing a 2000ms latency when serving any files from the SPA.
To Reproduce
Running Angular as a SPA in .net core 3.1 (new project).
The text was updated successfully, but these errors were encountered: