首页 > 解决方案 > 错误网关 = IIS 平台超时与 python 女服务员

问题描述

由于 2 分钟的超时,我得到了一个错误的网关,但我现在不知道如何配置它,以下是我尝试过的。

所以,首先,在python中我设置了一个120秒的超时(我不想改变这个,我已经尝试了115秒并且它工作但我想解决来自IIS或女服务员的外部超时,我不想在我的内部软件中更改此限制)。

try:
    # ...
    req = http.request("POST", url = url, timeout=120, body = body, headers=headers)
    # ...
except urllib3.exceptions.RequestError as exc:
    log.error("reporting exc type %s message %s", type(exc), exc)
    return render_template_string("External API is not responding")

我在 Web.config 中设置了这个

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <httpRuntime executionTimeout="200" />
    </system.web>
  <system.webServer>
  <handlers>
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform

ETC...

在我的女服务员批次中:

F:
cd F:\Appl\flask
venv\scripts\waitress-serve.exe --channel-timeout=300 --host=127.0.0.1 --port=%1 sample00:app

从 IIS 配置 > 限制我设置了“连接超时(以秒为单位):”200

标签: iisconnection-timeoutbad-gatewaywaitresshttpplatformhandler

解决方案


最后通过添加web.configrequestTimeout="00:05:00"的标签来解决httpPlatform


推荐阅读