You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
I've deployed my app to Azure and often when hitting it for the first time I get a "NodeInvocationException: The Node invocation timed out after 60000ms." exception. I've done some testing and have also hit this when deployed to IIS. I could increase the InvocationTimeoutMilliseconds property but is there a way to prevent node from 'sleeping' similar to the IIS Idle Timeout setting as I would prefer to have a faster first time load for users.
No, I don't use setInterval or similar. It's only really happens on a first load to node, not subsequent loads. It's rare I hit it locally so I can't double check the debug console right now but I don't think there's much else there of note. However here's a sample of my logs from the app deployed to IIS.
2017-01-11 10:05:14.5239|1|Microsoft.AspNetCore.Hosting.Internal.WebHost|INFO|Request starting HTTP/1.1 POST http://app:8077/Account/Login?returnurl=%2F application/x-www-form-urlencoded 278
2017-01-11 10:05:14.5239|3|Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware|INFO|HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Identity.Application.
2017-01-11 10:05:14.5239|1|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|INFO|Executing action method App.Controllers.AccountController.Login (src) with arguments (App.ViewModels.Account.LoginViewModel, /) - ModelState is Valid
2017-01-11 10:05:14.5749|10|Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware|INFO|AuthenticationScheme: Identity.Application signed in.
2017-01-11 10:05:14.5749|1|App.Controllers.AccountController|INFO|User logged in.
2017-01-11 10:05:14.5749|1|Microsoft.AspNetCore.Mvc.Internal.RedirectResultExecutor|INFO|Executing RedirectResult, redirecting to /.
2017-01-11 10:05:14.5749|2|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|INFO|Executed action App.Controllers.AccountController.Login (src) in 52.4201ms
2017-01-11 10:05:14.5749|2|Microsoft.AspNetCore.Hosting.Internal.WebHost|INFO|Request finished in 55.2503ms 302
2017-01-11 10:05:14.5999|1|Microsoft.AspNetCore.Hosting.Internal.WebHost|INFO|Request starting HTTP/1.1 GET http://app:8077/
2017-01-11 10:05:14.5999|3|Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware|INFO|HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Identity.Application.
2017-01-11 10:05:14.5999|1|Microsoft.AspNetCore.Authorization.DefaultAuthorizationService|INFO|Authorization was successful for user: chris.
2017-01-11 10:05:14.5999|1|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|INFO|Executing action method App.Controllers.HomeController.Index (src) with arguments ((null)) - ModelState is Valid
2017-01-11 10:05:14.6299|1|Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor|INFO|Executing ViewResult, running view at path /Views/Home/Index.cshtml.
2017-01-11 10:05:51.8376|2|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|INFO|Executed action App.Controllers.HomeController.Index (src) in 70820.7104ms
2017-01-11 10:05:52.0446|0|Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware|ERROR|An unhandled exception has occurred while executing the request The Node invocation timed out after 60000ms.
You can change the timeout duration by setting the InvocationTimeoutMilliseconds property on NodeServicesOptions.
The first debugging step is to ensure that your Node.js function always invokes the supplied callback (or throws an exception synchronously), even if it encounters an error. Otherwise, the .NET code has no way to know that it is finished or has failed.
2017-01-11 10:05:52.2386|2|Microsoft.AspNetCore.Hosting.Internal.WebHost|INFO|Request finished in 71236.0604ms 500 text/html; charset=utf-8
2017-01-11 10:05:52.2857|14|Microsoft.AspNetCore.Server.Kestrel|INFO|Connection id "0HL1PML4LN9NB" communication error Error -4077 ECONNRESET connection reset by peer
2017-01-11 10:05:52.2867|14|Microsoft.AspNetCore.Server.Kestrel|INFO|Connection id "0HL1PML4LN9NB" communication error Error -4077 ECONNRESET connection reset by peer
2017-01-11 10:05:52.2867|14|Microsoft.AspNetCore.Server.Kestrel|INFO|Connection id "0HL1PML4LN9NB" communication error Error -4077 ECONNRESET connection reset by peer
2017-01-11 10:05:52.2867|14|Microsoft.AspNetCore.Server.Kestrel|INFO|Connection id "0HL1PML4LN9NB" communication error Error -4077 ECONNRESET connection reset by peer
2017-01-11 10:06:14.6509|2|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|INFO|Executed action App.Controllers.HomeController.Index (src) in 60046.301ms
2017-01-11 10:06:14.6659|0|Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware|ERROR|An unhandled exception has occurred while executing the request The Node invocation timed out after 60000ms.
You can change the timeout duration by setting the InvocationTimeoutMilliseconds property on NodeServicesOptions.
The first debugging step is to ensure that your Node.js function always invokes the supplied callback (or throws an exception synchronously), even if it encounters an error. Otherwise, the .NET code has no way to know that it is finished or has failed.
Is your project based on one of the generator-aspnetcore-spa templates? If so, is it by any chance an old version that still uses asp-prerender-webpack-config in your Index.cshtml file? If you are still using asp-prerender-webpack-config, please be aware that it is very slow to start on the first hit (because it's building your app in production on the first hit) - more up-to-date templates have a different system for prebuilding the prerendering bundle during deployment, so the first hit is reliably very fast.
is there a way to prevent node from 'sleeping' similar to the IIS Idle Timeout setting as I would prefer to have a faster first time load for users
Node on its own never sleeps (and the NodeService package doesn't shut it down once it's started, except if the process has to be recycled because a source file changed, which wouldn't happen in production). If you're finding that your Node process gets shut down and has to restart, then I expect that must be because the parent (.NET) process itself is getting shut down. So it's somewhat beyond the control of any code in Node.js/NodeServices. If you keep your ASP.NET process alive, then the child Node process will stay alive too.
Is your project based on one of the generator-aspnetcore-spa templates? If so, is it by any chance an old version that still uses asp-prerender-webpack-config in your Index.cshtml file?
Yes, that's what I'm using. That does sound like my issue, I'll modify my project to match the latest method when I get the chance.
I have the same problem. I created a Angluar 4 + ASP.NET Web core 2 project on VS2017 and it works fine on a machine where it is created. But when the repo is cloned on another machine and app is started I get this error. I tried on one more machine and it is the same error. My Index.html looks like @SteveSandersonMS
In My case resolution was (windows machine):
Node command was already registered for exe present @ "C:\Program Files\Microsoft HPC Pack 2012\Bin".
I renamed this command and then Node command from cmd was diverted to NODE js properly.
Now SPA template runs fines on machine.
Activity
MarkPieszak commentedon Jan 17, 2017
What errors are you seeing in the debug console in Vscode or vstudio ?
Do you have a setInterval or similar in your code?
chris-herring commentedon Jan 17, 2017
No, I don't use setInterval or similar. It's only really happens on a first load to node, not subsequent loads. It's rare I hit it locally so I can't double check the debug console right now but I don't think there's much else there of note. However here's a sample of my logs from the app deployed to IIS.
SteveSandersonMS commentedon Jan 20, 2017
Is your project based on one of the
generator-aspnetcore-spatemplates? If so, is it by any chance an old version that still usesasp-prerender-webpack-configin yourIndex.cshtmlfile? If you are still usingasp-prerender-webpack-config, please be aware that it is very slow to start on the first hit (because it's building your app in production on the first hit) - more up-to-date templates have a different system for prebuilding the prerendering bundle during deployment, so the first hit is reliably very fast.Node on its own never sleeps (and the NodeService package doesn't shut it down once it's started, except if the process has to be recycled because a source file changed, which wouldn't happen in production). If you're finding that your Node process gets shut down and has to restart, then I expect that must be because the parent (.NET) process itself is getting shut down. So it's somewhat beyond the control of any code in Node.js/NodeServices. If you keep your ASP.NET process alive, then the child Node process will stay alive too.
chris-herring commentedon Jan 21, 2017
Yes, that's what I'm using. That does sound like my issue, I'll modify my project to match the latest method when I get the chance.
Thanks
milanm commentedon Oct 16, 2017
I have the same problem. I created a Angluar 4 + ASP.NET Web core 2 project on VS2017 and it works fine on a machine where it is created. But when the repo is cloned on another machine and app is started I get this error. I tried on one more machine and it is the same error. My Index.html looks like @SteveSandersonMS
`@{
ViewData["Title"] = "Home Page";
}
Loading...
<script src="~/dist/vendor.js" asp-append-version="true"></script>@section scripts {
<script src="~/dist/main-client.js" asp-append-version="true"></script>
}`
kulkarnisachin07 commentedon Jan 2, 2018
In My case resolution was (windows machine):
Node command was already registered for exe present @ "C:\Program Files\Microsoft HPC Pack 2012\Bin".
I renamed this command and then Node command from cmd was diverted to NODE js properly.
Now SPA template runs fines on machine.