gpt4 book ai didi

c# - 部署在 IIS 上的 ASP.NET Core 为长时间运行的请求返回 502 错误

转载 作者:行者123 更新时间:2023-12-03 19:04:51 25 4
gpt4 key购买 nike

我有一个 ASP.NET Core 2 Web 应用程序,它托管在 Windows Server 2012 上的 IIS 10 上,没有任何负载平衡和特殊配置。对于某些耗时过长的 MVC 操作,我们会收到 502 HTTP 错误。

enter image description here

看到这个错误后我很震惊,因为我没有任何代理服务器等配置。然后我想起了 ASP.NET Core 在 Kestrel 上运行。所以我得出这个结论,这里IIS扮演代理服务器的角色,将请求转发给Kestrel。所以我认为这在某种程度上与超时配置有关,因为应用程序的其他部分运行良好。我在 SO 上搜索了类似的问题,但没有找到解决方案。

最佳答案

默认情况下,ASP.NET Core 请求超时为 2 分钟,您可以通过设置文件中的 requestTimeout 更改它。查看更多 here

requestTimeout Optional timespan attribute.

Specifies the duration for which the ASP.NET Core Module will wait for a response from the process listening on %ASPNETCORE_PORT%.

The default value is "00:02:00".

The requestTimeout must be specified in whole minutes only, otherwise it defaults to 2 minutes.

关于c# - 部署在 IIS 上的 ASP.NET Core 为长时间运行的请求返回 502 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48869489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com