NET Core 应用程序 IIS 运行报错 502.3-Gateway & IIS 7.x Application Request Routing(ARR) 502错误的解决方法(转载)

1.NET Core 应用程序 IIS 运行报错 502.3-Gateway

将 NET Core 应用程序部署在 IIS 环境,默认配置下,如果任务执行时间长达 2 分钟,会收到如下错误(Bad Gateway):

如果要执行长时间任务,可以修改发布后的 web.config 文件的 system.webServer / aspNetCore 节,为其添加 requestTimeout 属性:

<system.webServer>
  <aspNetCore requestTimeout="00:20:00" ... />
</system.webServer>

属性说明:

    • requestTimeout
      可选的 timespan 属性。
      指定 ASP.NET 核心模块将等待侦听 %aspnetcore_port%的进程的响应的持续时间。
      默认值为“00:02:00”。
       requestTimeout  必须指定整分钟数,否则它将默认为 2 分钟。
参考

原文链接:NET Core 应用程序 IIS 运行报错 502.3-Gateway - FeelRose - 博客园 (cnblogs.com)

 

2.IIS 7.x Application Request Routing(ARR) 502错误的解决方法

 IIS ARR可实现基于反向代理的Server Farms,默认配置会导致在需要长时间操作超时的502.3错误,具体解释可以参考http://blogs.iis.net/richma/archive/2010/07/03/502-3-bad-gateway-the-operation-timed-out-with-iis-application-request-routing-arr.aspx

文章也提供了命令行执行相关操作:

Server Farm :  appcmd.exe set config  -section:webFarms /[name='ArrFarm'].applicationRequestRouting.protocol.timeout:"00:00:45"  /commit:apphost

这个操作也可以通过IIS的控制面板进行操作:

 

修改这个Time-out为 足够长的时间值就可以解决。

 

原文链接:IIS 7.x Application Request Routing(ARR) 502错误的解决方法_张善友的技术博客_51CTO博客

posted @ 2023-08-30 20:46  峨嵋峰  阅读(1055)  评论(0编辑  收藏  举报