Bad Gateway = IIS 平台与 python 女服务员超时
Bad Gateway = Timeout from IIS Platform with python waitress
由于 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
等...
在我的女服务员批次中:
F:
cd F:\Appl\flask
venv\scripts\waitress-serve.exe --channel-timeout=300 --host=127.0.0.1 --port=%1 sample00:app
然后从 IIS 配置 > 限制
我设置了“连接超时(以秒为单位):”200
最后在web.config
的httpPlatform
标签中添加requestTimeout="00:05:00"
解决了
由于 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
等...
在我的女服务员批次中:
F:
cd F:\Appl\flask
venv\scripts\waitress-serve.exe --channel-timeout=300 --host=127.0.0.1 --port=%1 sample00:app
然后从 IIS 配置 > 限制 我设置了“连接超时(以秒为单位):”200
最后在web.config
的httpPlatform
标签中添加requestTimeout="00:05:00"
解决了