带有 angular 错误 NodeInvocationException 的 aspnetcore:节点调用在 60000 毫秒后超时
aspnetcore with angular error NodeInvocationException: The Node invocation timed out after 60000ms
我正在使用 yo generator-aspnetcore-spa
一旦我 运行 我遇到问题的应用程序
An unhandled exception occurred while processing the request.
NodeInvocationException: 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.
Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance+d__13.MoveNext()
NodeInvocationException: 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.
这条线上的颜色是红色
AspNetCore._Views_Home_Index_cshtml+d__31.MoveNext() in
Index.cshtml
+
ViewData["Title"] = "Home Page";
这就是我的 package.json 的样子
{
"name": "WebApplicationBasic",
"version": "0.0.0",
"dependencies": {
"@angular/animations": "^4.3.0",
"@angular/common": "^4.3.0",
"@angular/compiler": "^4.3.0",
"@angular/core": "^4.3.0",
"@angular/forms": "^4.3.0",
"@angular/http": "^4.3.0",
"@angular/platform-browser": "^4.3.0",
"@angular/platform-browser-dynamic": "^4.3.0",
"@angular/platform-server": "^4.3.0",
"@angular/router": "^4.3.0",
"@types/node": "^7.0.38",
"angular2-template-loader": "^0.6.2",
"aspnet-prerendering": "^2.0.6",
"aspnet-webpack": "^1.0.29",
"awesome-typescript-loader": "^3.2.1",
"bootstrap": "^3.3.7",
"css": "^2.2.1",
"css-loader": "^0.28.4",
"es6-shim": "^0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "^0.7.3",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.11.2",
"html-loader": "^0.4.5",
"isomorphic-fetch": "^2.2.1",
"jquery": "^3.2.1",
"json-loader": "^0.5.4",
"ng-snotify": "^2.0.3",
"ngx-cookie": "^1.0.0",
"preboot": "^4.5.2",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.2",
"style-loader": "^0.17.0",
"to-string-loader": "^1.1.5",
"typescript": "^2.4.1",
"url-loader": "^0.5.9",
"webpack": "^2.7.0",
"webpack-hot-middleware": "^2.18.2",
"webpack-merge": "^4.1.0",
"zone.js": "^0.8.14"
}
}
我的应用程序运行良好,我不知道这个问题的原因是什么
问题出在 aspnet-prerendering 模块中
在视图>>主页>>Index.csHtml
中看起来像这样
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
然后当我删除它时,应用程序运行正常
<app>Loading...</app>
但是这当然没有服务器端渲染
所以当我完成应用程序的开发后,我将这个命令写在我项目的根目录中
webpack --config webpack.config.vendor.js
webpack
并恢复了
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
它应该是这样工作的:)
我遇到了同样的问题。这可能是节点本地版本的问题。
我将我的本地 nodejs 版本设置为 5.4.3 并且能够获取应用程序 运行ning,请尝试在您的 console/terminal:
上使用此检查您的节点版本
node -v
我认为删除预渲染标签然后 运行ning webpack 可能仍然会从服务器端预渲染中排除该模块,因此希望较新的节点版本可以帮助 运行 应用程序如预期的那样无需代码变化。
这里也有类似的问题:
不完全是这个问题的答案,但我遇到了同样的问题并来到这里。
我安装了 Windows HPC 包,这意味着我的 PATH 上的 node.exe 是 Windows HPC node command 而不是第三方 NodeJS node.exe
这意味着我得到了超时,因为它是 运行 宁 HPC 节点命令而不是使用 NodeJS 到 运行 webpack。为了修复,我从 PATH 环境变量中删除了路径并重新启动 Visual Studio。我本可以重新排序路径,或重命名其中一个 node.exe,但我不使用命令行中的 HPC 命令,仅使用代码。
讨论NodeJS中的冲突https://github.com/nodejs/node-v0.x-archive/issues/7773
我们在 Azure 中托管我们的站点,我的解决方案是将此配置 key/value 添加到应用程序设置中。
键:WEBSITE_NODE_DEFAULT_VERSION
值:6.9.1
我想您也可以将它添加到您的 appsetting.json 或 web.config。
我正在使用 yo generator-aspnetcore-spa
一旦我 运行 我遇到问题的应用程序
An unhandled exception occurred while processing the request.
NodeInvocationException: 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. Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance+d__13.MoveNext()
NodeInvocationException: 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.
这条线上的颜色是红色
AspNetCore._Views_Home_Index_cshtml+d__31.MoveNext() in Index.cshtml + ViewData["Title"] = "Home Page";
这就是我的 package.json 的样子
{
"name": "WebApplicationBasic",
"version": "0.0.0",
"dependencies": {
"@angular/animations": "^4.3.0",
"@angular/common": "^4.3.0",
"@angular/compiler": "^4.3.0",
"@angular/core": "^4.3.0",
"@angular/forms": "^4.3.0",
"@angular/http": "^4.3.0",
"@angular/platform-browser": "^4.3.0",
"@angular/platform-browser-dynamic": "^4.3.0",
"@angular/platform-server": "^4.3.0",
"@angular/router": "^4.3.0",
"@types/node": "^7.0.38",
"angular2-template-loader": "^0.6.2",
"aspnet-prerendering": "^2.0.6",
"aspnet-webpack": "^1.0.29",
"awesome-typescript-loader": "^3.2.1",
"bootstrap": "^3.3.7",
"css": "^2.2.1",
"css-loader": "^0.28.4",
"es6-shim": "^0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "^0.7.3",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.11.2",
"html-loader": "^0.4.5",
"isomorphic-fetch": "^2.2.1",
"jquery": "^3.2.1",
"json-loader": "^0.5.4",
"ng-snotify": "^2.0.3",
"ngx-cookie": "^1.0.0",
"preboot": "^4.5.2",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.2",
"style-loader": "^0.17.0",
"to-string-loader": "^1.1.5",
"typescript": "^2.4.1",
"url-loader": "^0.5.9",
"webpack": "^2.7.0",
"webpack-hot-middleware": "^2.18.2",
"webpack-merge": "^4.1.0",
"zone.js": "^0.8.14"
}
}
我的应用程序运行良好,我不知道这个问题的原因是什么
问题出在 aspnet-prerendering 模块中 在视图>>主页>>Index.csHtml
中看起来像这样<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
然后当我删除它时,应用程序运行正常
<app>Loading...</app>
但是这当然没有服务器端渲染 所以当我完成应用程序的开发后,我将这个命令写在我项目的根目录中
webpack --config webpack.config.vendor.js
webpack
并恢复了
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
它应该是这样工作的:)
我遇到了同样的问题。这可能是节点本地版本的问题。
我将我的本地 nodejs 版本设置为 5.4.3 并且能够获取应用程序 运行ning,请尝试在您的 console/terminal:
上使用此检查您的节点版本node -v
我认为删除预渲染标签然后 运行ning webpack 可能仍然会从服务器端预渲染中排除该模块,因此希望较新的节点版本可以帮助 运行 应用程序如预期的那样无需代码变化。
这里也有类似的问题:
不完全是这个问题的答案,但我遇到了同样的问题并来到这里。
我安装了 Windows HPC 包,这意味着我的 PATH 上的 node.exe 是 Windows HPC node command 而不是第三方 NodeJS node.exe
这意味着我得到了超时,因为它是 运行 宁 HPC 节点命令而不是使用 NodeJS 到 运行 webpack。为了修复,我从 PATH 环境变量中删除了路径并重新启动 Visual Studio。我本可以重新排序路径,或重命名其中一个 node.exe,但我不使用命令行中的 HPC 命令,仅使用代码。
讨论NodeJS中的冲突https://github.com/nodejs/node-v0.x-archive/issues/7773
我们在 Azure 中托管我们的站点,我的解决方案是将此配置 key/value 添加到应用程序设置中。
键:WEBSITE_NODE_DEFAULT_VERSION
值:6.9.1
我想您也可以将它添加到您的 appsetting.json 或 web.config。