azure-functions - Azure Static Web App + Azure Function + PuppeteerSharp 给出 UnauthorizedAccessException
问题描述
当我使用使用PuppeteerSharp的Azure 函数将我的Azure 静态 Web 应用程序部署到 Azure 时,我在Application Insights中看到以下错误:
Exception while executing function: ProductsGet Access to the path 'C:\Program Files (x86)\SiteExtensions\Functions\3.3.1\32bit\.local-chromium' is denied.
如果我在本地查看,有一个 'bin\Debug\netcoreapp3.1' 文件夹,其中有一个 '.local-chromium' 文件夹。
我试图更改“.local-chromium”文件夹所在的路径
var tempPath = Path.Combine(rootPath, "bin/.local-chromium");
var browserFetcher = new BrowserFetcher(new BrowserFetcherOptions
{
Path = tempPath
});
await browserFetcher.DownloadAsync();
await using var browser = await Puppeteer.LaunchAsync(
new LaunchOptions
{
Headless = true,
ExecutablePath = browserFetcher.RevisionInfo(BrowserFetcher.DefaultChromiumRevision).ExecutablePath
}
);
但这不起作用。使用普通的Azure Functions,我可以使用Kudu查看文件夹结构。Azure 静态 Web 应用程序也可以做到这一点吗?
解决方案
推荐阅读
- python - residplot seaborn 中的参数应该是什么
- kubernetes - GKE - 单击以部署 - prometheus-server 无法启动,因为“打开存储失败打开 /data/XXX/meta.json:没有这样的文件或目录”
- android - 如何在 RadioButton 中设置布局而不是文本
- selenium - 驱动程序信息:驱动程序版本:Selenium 和 Geckodriver 的未知 (Behat\Mink\Exception\DriverException) 错误
- angular - Angular - 类型“”上不存在属性“”
- ruby - 创建具有复杂结构的 FactoryBot Hash 模型,包括多个嵌套属性
- swift - 如何调整 UITextField.leftView 的大小?
- c# - 像在 Blender 中一样在 Unity 2D 中制作虚线
- cybersource - 请在 CyberSource 身份验证方面需要一些帮助
- spring - 缓存查询结果并对它进行较小的查询