簡體   English   中英

使用Microsoft.AspNetCore.NodeServices調用JS文件時,獲取節點調用超時錯誤

[英]Getting Node invocation timed out error when invoking JS file using Microsoft.AspNetCore.NodeServices

使用Microsoft.AspNetCore.NodeServices調用JS文件時, 標題獲取節點調用超時錯誤

功能影響我開發了使用NodeServices的應用程序,並使用以下文章將其部署在Azure上: https ://code.msdn.microsoft.com/How-to-export-HTML-to-PDF-c5afd0ce

它在本地運行,但不適用於已部署的版本。 獲取節點超時錯誤:

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. | Source: Microsoft.AspNetCore.NodeServices

預期結果 PDF應該被創建。

實際結果 NodeService拋出超時錯誤

但是仍然在部署版本上出現超時錯誤。 任何幫助,將不勝感激。 謝謝。

您可以在將NodeServices添加到服務容器時指定超時-您還可以在那里設置ILogger,這可能有助於您調試問題:

services.AddNodeServices(options =>
{
    options.InvocationTimeoutMilliseconds = TimeSpan.FromMinutes(5).Milliseconds;
    options.NodeInstanceOutputLogger = log;

});

Azure Web App不支持PhantomJS。 更多信息在這里
我最終將Azure Web App用於容器

這是我的博客文章,介紹如何在Docker上使用NodeServices在ASP.NET Core中執行此操作: Link
(盡管它使用另一個節點包)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM