将 API 作为后端池的 Azure 应用程序网关不起作用 [英] Azure Application Gateway with API as a backend pool is not working
问题描述
我在 Web 应用程序中有 .net 核心 API,并且该 Web 应用程序是 azure 应用程序网关的后端池.尝试访问网络应用时出现以下错误.
I have .net core API inside the web app and that web app is backend pool for azure application gateway. while trying to access the web app got below error.
502 - Web 服务器在充当网关或代理服务器时收到无效响应."
"502 - Web server received an invalid response while acting as a gateway or proxy server."
在应用程序 GW 上,该 Web 应用程序的运行状况问题处于不健康状态,但同时以 https 访问 API://abc.azurewebsites.net/api/values 然后它就可以工作了.
On app GW, health prob for that web app in unhealthy but while access the API as a https://abc.azurewebsites.net/api/values then it works.
推荐答案
当我们在 Web 应用服务中部署 API 时,apiname.azurewebsites.net 不起作用给应用程序网关提供任何探测并处理不健康.API 像 xxx.azurewebsites.net/api/values 一样工作,应用程序网关也知道这个路径.我们必须将/api/values 放在 http 设置的覆盖后端路径中.健康探测也是如此.
When we deploy API in Web App Service then apiname.azurewebsites.net does not work give any probes to application gateway and treat unhealthy. API works like xxx.azurewebsites.net/api/values and Application Gateway also know this path. We have to put /api/values in override backend path of http settings. Same have to do in health probes.
这篇关于将 API 作为后端池的 Azure 应用程序网关不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!