执行此服务30秒后,我收到错误
<s:HTTPService id="svcList" url="http://localhost/index.php" method="GET" result="svcList_resultHandler(event)" fault="svcList_faultHandler(event)" requestTimeout="300">
<s:request xmlns="">
<mod>module</mod>
<op>operation</op>
</s:request>
</s:HTTPService>
此操作需要比平时更长的时间,所以我将php的最大执行时间更改为120秒。
当通过浏览器请求时,脚本可以正常运行,即http://localhost/index.php?mod=module&op=operation
我已经检查了错误事件对象的答案,并在faultDetails Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost/index.php" errorID=2032]. URL: http://localhost/index.php
找到了这个
请求是否有执行时间限制?
修改:已使用requetTimeout
。
由于
答案 0 :(得分:9)
好的,在我的工作环境(Flex SDK 4.1 - AIR 2.6)
中,只使用requestTimeout="xx"
无效,我不知道为什么。
但是设置一个非常全局的对象URLRequestDefaults
属性idleTimeout
可以正常工作。
我的问题的解决方案是此配置,位于应用程序的顶部。
import flash.net.URLRequestDefaults;
URLRequestDefaults.idleTimeout = 120000; //note this value represents milliseconds (120 secs)
我相信这可以帮助某人。
答案 1 :(得分:1)
虽然似乎假设requestTimeout不起作用。它确实......第一次。
在第一个请求之后,requestTimeout在
中设置HTTPService.channelSet.currentChannel.requestTimeout
如果你必须改变超时,你会想要在那里做。
要查看具体的违规代码,请参阅AbstractOperation.getDirectChannelSet()。即使对于HTTPService的不同实例,它也来自:
private static var _directChannelSet:ChannelSet;
_directChannelSet仅实例化一次,其上的requestTimeout仅在创建时设置,因此即使您在HTTPService上更改requestTimeout,它也不会反映在请求中。
答案 2 :(得分:0)
您可以设置http服务对象的请求时间,这将执行它在锡上所说的内容,但如果您想了解更多信息,请参阅以下语言参考链接:
以下示例说明了如何在120秒的时间内查看代码段:
<s:HTTPService id="svcList" requestTimeout="120" url="http://localhost/index.php" method="GET" result="svcList_resultHandler(event)" fault="svcList_faultHandler(event)">
<s:request xmlns="">
<mod>module</mod>
<op>operation</op>
</s:request>
</s:HTTPService>
另外值得注意的是,如果将此属性设置为零或更少,请求将根本不会超时(根据语言参考)。