Intermittent stream errors (#2032) with Flex 3, IE and ASP.NET
I am having a nightmare with the following problem which I have tried to present as simply as possible by describing the simplest test case where I have managed to re-create the problem.
Firstly, I have an ASP.NET application.
Secondly, I have a Flex client which uses HTTPService to access the resources on the ASP.NET web site.
services are accessed with code like this:
<mx:HTTPService id="rpcTest"
url="{url}"
result="onServiceResult(event)"
method="GET"
resultFormat="text"
useProxy="false"
showBusyCursor="true">
</mx:HTTPService>
In my Flex app, I have a button which does this:
private function doTest2():void
{
arrMsgs.removeAll();
mgrTest1.loadData(someUrl);
mgrTest2.loadData(someUrl);
mgrTest3.loadData(someUrl);
}
where each mgrTest* object is an MXML component wrapping an HTTPService as described above:
The problem is that clicking this button can cause the following error:
[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost:50352/Home/About"]. URL: http://localhost:50352/Home/About"] at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:220] at mx.rpc::Responder/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53] at mx.rpc::AsyncRequest/fault()[C:\auto开发者_运维百科build\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103] at DirectHTTPMessageResponder/errorHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:362] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
It is the intermittent behaviour that really has me stumped!
Observations:
1 - The problem is intermittent. It often happens the first time I click the button. It almost never happens again if I just keep clicking the button (i.e. all services work). If I then wait for 5 mins or so and click the button again it almost always fails again.
2 - It never happens if I just call one service instead of three.
3 - It never happens in Firefox
4 - If I try to use Fiddler / Charles to inspect traffic on the client machine it never happens.
5 - It doesn't seem to matter what type of resource I access on the ASP.NET site. (aspx, ashx, xml)
6 - It doesn't seem to matter what the HTTPService result format is set to.
7 - I have not managed to recreate the issue accessing resources from a non ASP.NET site.
I have wrestled with this for days, and the best I have come up with is to use a timer firing every 5 seconds which uses a HTTPService to access a simple stay-alive url on the server. For some reason this seems to help, but I'm not sure why, or even if I can depend on it as a solution.
If anyone can help, I would be very grateful. (I have an embarrassing situation with a cutomer that I need to address :-(
Thanks
Gary B
Headers Example:
HTTP/1.1 200 OK Server: ASP.NET Development Server/10.0.0.0 Date: Wed, 15 Jun 2011 11:04:09 GMT X-AspNet-Version: 4.0.30319 X-AspNetMvc-Version: 3.0 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 921 Connection: Close
I took these from Fiddler, of course, once I use Fiddler I never get the error! I assume the headers are same as would be returned to Flex if Fiddler wasn't there. Not sure if I can get at the headers in Flex.
精彩评论