Https 在Angular2 http模块中增加http get请求连接超时
我在客户端使用Angular2,在后端使用Node。我试图保持https连接打开,直到它在4小时内超时 在后端,我尝试调用它,但它仍然在默认情况下超时2分钟Https 在Angular2 http模块中增加http get请求连接超时,https,timeout,Https,Timeout,我在客户端使用Angular2,在后端使用Node。我试图保持https连接打开,直到它在4小时内超时 在后端,我尝试调用它,但它仍然在默认情况下超时2分钟 request.timeout(1000*60*60*4,函数(){}) 因为我使用Angular2 http模块。我尝试在http请求中使用超时方法,如下所示,此超时默认为2分钟: 返回this.http.get(this.URL,{search:params,withCredentials:true}) .map(res=>res.js
request.timeout(1000*60*60*4,函数(){})
因为我使用Angular2 http模块。我尝试在http请求中使用超时方法,如下所示,此超时默认为2分钟:
返回this.http.get(this.URL,{search:params,withCredentials:true})
.map(res=>res.json())
.超时(1000*60*60*4)
.接住(这个.把手错误)代码>
将https请求连接从默认的2分钟增加到4小时的任何其他建议如下:
- 等待4小时等待响应不是一个好的设计。请尝试更改后端以获得更快的响应
- 将requestTimeout添加到项目的web.config文件中修复了这个问题
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore requestTimeout="00:10:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>