gpt4 book ai didi

xml - 如何使用 asp 设置 http 超时?

转载 作者:数据小太阳 更新时间:2023-10-29 01:46:09 26 4
gpt4 key购买 nike

这是我的asp代码

<%
http = server.createobject("microsoft.xmlhttp")
http.open "post", servleturl, false
http.setrequestheader "content-type", "application/x-www-form-urlencoded"
http.setrequestheader "accept-encoding", "gzip, deflate"
http.send "request=" & sxml
http_response = http.responsetext
%>

我需要在 15 秒内没有响应时超时,怎么办?

最佳答案

您也可以像这样调用“SetTimeouts”来继续使用同步请求:

<%
Dim http

Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
http.SetTimeouts 600000, 600000, 15000, 15000
http.Open "post", servleturl, false
http.SetRequestHeader "content-type", "application/x-www-form-urlencoded"
http.SetRequestHeader "accept-encoding", "gzip, deflate"
http.Send "request=" & sxml

http_response = http.responsetext
%>

请在此处查看 docs .

参数是:

setTimeouts (long resolveTimeout, long connectTimeout, long sendTimeout, long receiveTimeout)

The setTimeouts method should be called before the open method. None of the parameters is optional.

关于xml - 如何使用 asp 设置 http 超时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14052543/

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