将 API 作为后端池的 Azure 应用程序网关无法正常工作
Azure Application Gateway with API as a backend pool is not working
我在 Web 应用程序中有 .net 核心 API,该 Web 应用程序是 Azure 应用程序网关的后端池。尝试访问网络应用程序时出现以下错误。
“502 - Web 服务器在充当网关或代理服务器时收到无效响应。”
在应用程序 GW 上,该 Web 应用程序的运行状况概率处于不健康状态,但在以 https://abc.azurewebsites.net/api/values 访问 API 时它可以正常工作。
是的,你可以先验证一下后台API是否可以不用app gateway直接访问。那么出现这个错误的主要原因可能有以下几点:
- NSG, UDR or Custom DNS is blocking access to backend pool members.
- Back-end VMs or instances of virtual machine scale set are not responding to the default health probe.
- Invalid or improper configuration of custom health probes.
- Azure Application Gateway's back-end pool is not configured or empty.
- None of the VMs or instances in virtual machine scale set are healthy.
- Request time-out or connectivity issues with user requests.
一般情况下,Backend healthy
的状态和详情可以指出来,显示一些线索。以上原因你也可以根据这个DOC.
一一验证
当我们在 Web App Service 中部署 API 时,apiname.azurewebsites.net 将不起作用,对应用程序网关进行任何探测并处理不健康的问题。 API 的工作方式与 xxx.azurewebsites.net/api/values 类似,应用程序网关也知道此路径。我们必须将 /api/values 放入 override backend path of http settings。在 h 健康探测中也必须这样做。
我在 Web 应用程序中有 .net 核心 API,该 Web 应用程序是 Azure 应用程序网关的后端池。尝试访问网络应用程序时出现以下错误。
“502 - Web 服务器在充当网关或代理服务器时收到无效响应。”
在应用程序 GW 上,该 Web 应用程序的运行状况概率处于不健康状态,但在以 https://abc.azurewebsites.net/api/values 访问 API 时它可以正常工作。
是的,你可以先验证一下后台API是否可以不用app gateway直接访问。那么出现这个错误的主要原因可能有以下几点:
- NSG, UDR or Custom DNS is blocking access to backend pool members.
- Back-end VMs or instances of virtual machine scale set are not responding to the default health probe.
- Invalid or improper configuration of custom health probes.
- Azure Application Gateway's back-end pool is not configured or empty.
- None of the VMs or instances in virtual machine scale set are healthy.
- Request time-out or connectivity issues with user requests.
一般情况下,Backend healthy
的状态和详情可以指出来,显示一些线索。以上原因你也可以根据这个DOC.
当我们在 Web App Service 中部署 API 时,apiname.azurewebsites.net 将不起作用,对应用程序网关进行任何探测并处理不健康的问题。 API 的工作方式与 xxx.azurewebsites.net/api/values 类似,应用程序网关也知道此路径。我们必须将 /api/values 放入 override backend path of http settings。在 h 健康探测中也必须这样做。