首页 新闻 会员 周边

MVC调用返回 502

0
[已解决问题] 解决于 2022-04-02 14:21

ajax postman

IIS 调用一个接口返回 502 - Web server received an invalid response while acting as a gateway or proxy server.

  
        public ActionResult  ExecuteThingsOne()
        {
            if (Monitor.TryEnter(objInLock))
            {
                try
                {
                      // 准备数据(耗时约10秒)
                       ......
                    // POST 同步调用接口(耗时约60秒)
                     ......
                   return Content(new Result {Success = true }.ToJson());
                }
                catch (Exception ex)
                {
                       return Content(new Result {Success = false}.ToJson());
                }
                finally
                {
                    Monitor.Exit(objInLock);
                }
            }
            else
            {
                return Content(new Result{Success = false }.ToJson());
            }
        }
cker90的主页 cker90 | 菜鸟二级 | 园豆:258
提问于:2022-03-30 16:10
< >
分享
最佳答案
0

你的请求是通过反向代理server到达IIS MVC程序的吧

 

奖励园豆:5
talentzemin | 小虾三级 |园豆:757 | 2022-03-30 20:12

不是呀,应用是直接部署在IIS的,只是有负载均衡

cker90 | 园豆:258 (菜鸟二级) | 2022-03-31 08:40

是要设置请求等待时间么

cker90 | 园豆:258 (菜鸟二级) | 2022-03-31 08:45

@cker90: 看错误信息是upstream服务器返回有问题,直接访问IIS上的程序看返回结果(不通过负载均衡服务器)

talentzemin | 园豆:757 (小虾三级) | 2022-03-31 09:15

@luzemin: 感谢,已经调整负载均衡服务器请求时间

cker90 | 园豆:258 (菜鸟二级) | 2022-04-02 14:20
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册