Apache flex Flex HTTPService仍然超时
执行此服务30秒后,我收到一个错误Apache flex Flex HTTPService仍然超时,apache-flex,air,httprequest,Apache Flex,Air,Httprequest,执行此服务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
<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
我已经检查了FaultEvent对象以获取答案,并在faultDetailsError:[IOErrorEvent type=“ioError”bubbles=false cancelable=false eventPhase=2 text=“Error\2032:流错误。URL:http://localhost/index.php“errorID=2032]。网址:http://localhost/index.php
请求是否有执行时间限制
编辑:已使用requetTimeout
谢谢您可以设置http服务对象的请求时间,这将按照tin上的说明执行,但是如果您想了解更多信息,这里有一个语言参考链接: 下面是一个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>
模块
活动
同样值得注意的是,如果您将此属性设置为零或更少,请求将不会超时(根据语言ref)。好的,在我的工作环境
(Flex SDK 4.1-AIR 2.6)
中,仅使用requestTimeout=“xx”
不起作用,我不知道为什么
但是设置一个非常全局的对象URLRequestDefaults
propertyidleTimeout
可以满足我的需要
我的问题的解决方案是在应用程序顶部的这种配置
import flash.net.URLRequestDefaults;
URLRequestDefaults.idleTimeout = 120000; //note this value represents milliseconds (120 secs)
我相信这会对某些人有所帮助。尽管似乎假定requestTimeout不起作用。事实上。。。第一次 在第一次请求之后,requestTimeout在中设置
HTTPService.channelSet.currentChannel.requestTimeout
如果您必须更改超时,您将希望在那里进行更改
要查看特定的违规代码,请参阅AbstractOperation.getDirectChannelSet()。即使对于HTTPService的不同实例,它也可以从以下方面获取:
private static var _directChannelSet:ChannelSet;
_directChannelSet只实例化一次,它的requestTimeout只在创建时设置,因此即使更改HTTPService上的requestTimeout,它也不会反映在请求中。此
requestTimeout
属性的工作方式与live docs中的描述不同。我以前试过,结果是一样的,没有任何变化。显然超时属性是特定于浏览器的,Chrome、Firefox和IE的表现都不同。我还没有做过对比测试,但值得一看,特别是如果你能选择一款适合你的浏览器(当然这是我的梦想!)。lifesaver,requestTimeout对我来说在flex 4上根本不起作用。