web-scraping - 502 - Web server received an invalid response while acting as a gateway or proxy server on Azure App Server
问题描述
502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
I am working Headless Browser that is ChromiumWebBrowser thats work fine on local machine and when we publish code on Azure App Service this gives us above mentioned error. Currently we use Shared infastructured (Free version for Testing).
region ChromiumWebBrowser
var browser = new ChromiumWebBrowser(url);
await LoadPageAsync(browser);
var result = browser.GetBrowser().MainFrame.GetSourceAsync().Result;
browser.Stop();
if (!browser.IsDisposed)
browser.Dispose();
#endregion
解决方案
感谢提问!只是为了确认您是否使用 GDI?由于使用无头浏览器 ChromiumWebBrowser 主要需要 GDI 支持和 Windows 上的 Azure App Services,因此与Win32k.sys (User32/GDI32) Restrictions冲突,如前所述,
为了彻底减少攻击面,沙箱阻止了几乎所有的 Win32k.sys API 被调用,这实际上意味着大部分 User32/GDI32 系统调用都被阻止了。对于大多数应用程序来说,这不是问题,因为大多数 Azure Web 应用程序不需要访问 Windows UI 功能(它们毕竟是 Web 应用程序)。然而,受影响的一种常见模式是 PDF 文件生成。有几种情况需要注意:
推荐阅读
- java - sharedPreference arraylist在线程中的for循环中获取indexoutofboundsexception
- python - 为什么 pip 不使用 sdist 包的元数据?
- webpack - Worker-load如何与antd pro集成?
- ansible - 仅在每个主机上的第一次运行时执行任务
- java - 更改 Eclipse 中的键绑定以接受代码完成建议
- angular - 错误:未捕获(承诺):NullInjectorError:R3InjectorError(AppModule)[baseURL]
- c++ - 相对简单的自定义容器签名不满足
概念 - python - 如何使用 Python 和 TensorFlow 服务模型调用特定模型版本?
- python - 从行中删除初始空格,在 python/pandas 中保留其他空格
- javascript - 如何仅反映已更改的行