简体   繁体   English

如何在 Azure 应用服务部署上安装浏览器

[英]How to install browser on Azure App Service deployment

I have a need to use puppeteer sharp on a Azure app service deployment.我需要在 Azure 应用服务部署上使用 puppeteer sharp。 Puppeteer sharp needs browser to do headless browsing. Puppeteer sharp 需要浏览器进行无头浏览。 Does Azure app service comes with Edge installed? Azure 应用服务是否安装了 Edge? If not, How can I install a browser (chrome) in Azure app service deployment?如果没有,如何在 Azure 应用服务部署中安装浏览器(chrome)?

You can't install Edge on App Service because it's a sandboxed environment.您无法在应用服务上安装 Edge,因为它是沙盒环境。 The simplest solution is to use a virtual machine because you have more control.最简单的解决方案是使用虚拟机,因为您拥有更多控制权。 You can also try to deploy your app in a container, install your dependencies and run it on App Service.您还可以尝试在容器中部署您的应用,安装您的依赖项并在应用服务上运行它。

A good way of getting around the no browser limitation of the app services is to use a 'browser as a service' service, like Browserless.绕过应用程序服务的无浏览器限制的一个好方法是使用“浏览器即服务”服务,例如 Browserless。

I've used Browserless for several months now and I've been very pleased with the service.我已经使用 Browserless 几个月了,我对这项服务非常满意。 They offer both usage-based and dedicated plans, to suit your needs and connecting to the service is very easy, like this example.他们提供基于使用的计划和专用计划,以满足您的需求,并且连接到服务非常容易,就像这个例子一样。

var connectOptions = new ConnectOptions() { BrowserWSEndpoint = "wss://chrome.browserless.io?token=YOURTOKENHERE" };
browser = await Puppeteer.ConnectAsync(connectOptions);

Once you've got your browser context, you can code your automated functionality as your normally would.获得浏览器上下文后,您可以像往常一样编写自动化功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复将node.js部署到无法通过npm安装的azure应用程序服务? - How can I fix deployment of node.js to azure app service that fails npm install? 如何在Azure App Service中安装自定义字体 - how to install custom font in azure app service 如何在 Microsoft Azure 的应用服务中安装 .exe? - How to install a .exe in the app service of Microsoft Azure? 如何在 Linux Azure 应用服务上安装数据包 - How to install packet on Linux Azure App Service 如何在 Azure 应用服务上安装二进制文件? - How to install a binary on Azure App Service? Azure:Azure应用服务的部署插槽的定价 - Azure: Pricing of deployment slots for an Azure App Service 如何加快缓慢的 Azure App Service Zip 部署? - How to speed up slow Azure App Service Zip Deployment? 如何在 Azure App Service 中实现真正的零停机部署 - How to achieve true zero downtime deployment in Azure App Service 如何在Azure App Service中设置或检索部署凭据? - How to set or retrieve deployment credentials in Azure App Service? 如何解决App Service的Azure部署插槽问题? - How to fix Azure Deployment slots issue for App Service?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM