在Microsoft Azure Web应用程序中运行无头Chrome

问题描述:

我目前正在使用phantomjs生成网页的屏幕截图. 由于各种问题,包括网络字体和视频标签支持,我想尝试切换到无头Chrome.

I am currently using phantomjs to generate screenshots of web pages. Due to various issues including web fonts, and video tag support, I would like to try switching to headless chrome.

有没有人成功在Azure Web应用程序中运行无头chrome? 我找不到.net api,并假设我需要使用puppeteer运行node.js,如果我想要类似于phantomjs的javascript API.

Has anyone had success running headless chrome in an azure web app? I cannot find a .net api, and assume I need to run node.js with puppeteer If I want a javascript api similar to phantomjs.

目前,大多数大型库 都是为NodeJS设计的.没有它,也可以无头运行Chrome,但是您需要一个.NET API库,以便与Chrome有效通信.如果不存在,则在此处中记录该协议本身,您可以为构建一个协议. NET.

Right now most of the big libraries are made for NodeJS. It's possible to run Chrome headless without it, but you'll need a library for your .NET API to effectively communicate with Chrome. If none exist, then the protocol itself is documented here, and you could build one for .NET.

如果您正在努力使Chrome在Azure上运行,我会提供一项提供Docker映像的服务,该服务可以像启动和运行一些命令一样简单(位于

If you're struggling to get Chrome running on Azure I have a service that offers Docker images, which could be as simple as a few commands to have up and running (located here). Other than that there's a few open-source options out there, but they have differing issues and uses-cases.