Azure - ASP.NET核心FileNotFoundException

问题描述 投票:1回答:1

我在Azure AppService(基本计划 - B1)中托管了一个ASP.NET Core webapp,我使用phantomjs从html生成一些pdf(基于https://github.com/TheSalarKhan/PhantomJs.NetCore)。

问题是,第二次生成pdf时,应用程序在启动进程时因FileNotFoundException而崩溃 - 请参阅https://github.com/TheSalarKhan/PhantomJs.NetCore/blob/d580fba1128756acc8384107a17b399397475dad/PdfGenerator.cs#L54(我正在使用Windows => windows_phantomjs.exe) - 第一次正常工作。我试图将windows_phantomjs.exe从wwwroot重新复制到PhantomJSRoot,但是当我这样做时,我又得到了一个FileNotFoundException:

File.Copy("D:\home\site\wwwroot\windows_phantomjs.exe", "D:\home\site\wwwroot\PhantomJSRoot\windows_phantomjs.exe", true);

Exception Info: System.IO.FileNotFoundException: Could not find file 'D:\home\site\wwwroot\windows_phantomjs.exe'.

奇怪的是文件确实存在于两个位置 - 我使用诊断控制台来查看Azure文件系统。

关于如何解决这个问题的任何想法?在开发框(macOS)上,代码第二次正常工作,第三次,依此类推......

azure phantomjs
1个回答
0
投票

使用Kudu将文件直接上传到该位置。恶意软件检测工具可能会在服务器端删除exe。沙盒,我建议你在容器中运行它。

© www.soinside.com 2019 - 2024. All rights reserved.