项目代码前台使用axios调用后台.net core的kestrel服务 但是有一个服务是依赖于第三方的查询 大概需要五分钟左右
这样导致前台会报Request failed with status code 499错误 试过设置axios的超时时间为10分钟
也试过axios的retry 但是就会一直进catch里 这个怎么解决 代码如下
axios
.post(url, param, { headers: { "loginToken": loginToken, "appDomainName": domain } }, { timeout:0 })
.then(function (response) {
success(response.data)
})
.catch(function (error) {
console.log("[ERROR][POST(" + url + ")]" + error.message);
let errorParam = {
code: 416,
message: '请求异常!原因:' + error.message,
data: error,
};
if (failed !== null && failed !== undefined) {
failed(errorParam);
} else {
this.ELEMENT.Notification({ title: '错误', type: 'error', message: error.message });
}
});
可能是因为服务器端处理的时间过长,客户端关闭了连接,看看服务器端有没有proxy_ignore_client_abort 参数,设置为proxy_ignore_client_abort on