我尝试使用 html-pdf nod 包和 .net core mvc 应用程序创建 PDF。它在本地工作正常。部署到 Azure Web 应用程序时出现以下错误。
在网页中:
SocketException:一个现有的连接被远程主机强制关闭未知位置
IOException: 无法从传输连接中读取数据:现有连接被远程主机强行关闭。
Azure Web 应用程序控制台:
2019-11-22 06:39:58.754 +00:00 [Error] Microsoft.AspNetCore.NodeServices: D:\home\site\wwwroot\Node\createPdf.js:5
2019-11-22 06:39:58.754 +00:00 [Error] Microsoft.AspNetCore.NodeServices: stream.pipe(result.stream);
2019-11-22 06:39:58.754 +00:00 [Error] Microsoft.AspNetCore.NodeServices: ^
2019-11-22 06:39:58.754 +00:00 [Error] Microsoft.AspNetCore.NodeServices:
2019-11-22 06:39:58.754 +00:00 [Error] Microsoft.AspNetCore.NodeServices: TypeError: Cannot read property 'pipe' of undefined
2019-11-22 06:39:58.754 +00:00 [Error] Microsoft.AspNetCore.NodeServices: at D:\home\site\wwwroot\Node\createPdf.js:5:16
2019-11-22 06:39:58.754 +00:00 [Error] Microsoft.AspNetCore.NodeServices: at D:\home\site\wwwroot\node_modules\html-pdf\lib\pdf.js:58:21
2019-11-22 06:39:58.755 +00:00 [Error] Microsoft.AspNetCore.NodeServices: at respond (D:\home\site\wwwroot\node_modules\html-pdf\lib\pdf.js:126:14)
2019-11-22 06:39:58.755 +00:00 [Error] Microsoft.AspNetCore.NodeServices: at Timeout.execTimeout (D:\home\site\wwwroot\node_modules\html-pdf\lib\pdf.js:91:5)