先看以下两个错误提示:
错误提示一
Error:(mx.messaging.messages::ErrorMessage)#0
body = (Object)#1
clientId = (null)
correlationId = "B1D1553B-8BFD-7B18-713D-2EFC80A3EC10"
destination = ""
extendedData = (null)
faultCode = "Channel.Call.Failed"
faultDetail = "NetConnection.Call.Failed: HTTP: Failed"
faultString = "error"
headers = (Object)#2
messageId = "49781D20-ED1C-9D1A-8A33-2EFC8540360B"
rootCause = (mx.messaging.events::ChannelFaultEvent)#3
bubbles = false
cancelable = false
channel = (mx.messaging.channels::AMFChannel)#4
authenticated = false
channelSets = (Array)#5
[0] (mx.messaging::ChannelSet)#6
authenticated = false
channelIds = (Array)#7
[0] (null)
channels = (Array)#8
[0] (mx.messaging.channels::AMFChannel)#4
clustered = false
connected = true
currentChannel = (mx.messaging.channels::AMFChannel)#4
heartbeatInterval = 0
initialDestinationId = (null)
messageAgents = (Array)#9
[0] (mx.rpc::AsyncRequest)#10
authenticated = false
autoConnect = true
channelSet = (mx.messaging::ChannelSet)#6
clientId = "0dfc25e4-5824-41ed-98fc-5322b73defd5"
connected = true
defaultHeaders = (null)
destination = "fluorine"
id = "4813511A-7E9D-7369-9614-2EFBA19337E3"
priority = -1
reconnectAttempts = 0
reconnectInterval = 0
requestTimeout = -1
subtopic = ""
connected = true
connectTimeout = -1
enableSmallMessages = true
endpoint = "http://localhost:1179/Web/Gateway.aspx"
failoverURIs = (Array)#11
id = (null)
mpiEnabled = false
netConnection = (flash.net::NetConnection)#12
client = (mx.messaging.channels::AMFChannel)#4
connected = false
maxPeerConnections = 8
objectEncoding = 3
proxyType = "none"
uri = "http://localhost:37813/Web/Gateway.aspx?hostport=localhost:1179&https=N&id=-1"
piggybackingEnabled = false
polling = false
pollingEnabled = true
pollingInterval = 3000
protocol = "http"
reconnecting = false
recordMessageSizes = false
recordMessageTimes = false
requestTimeout = -1
uri = "http://localhost:1179/Web/Gateway.aspx"
url = "http://localhost:1179/Web/Gateway.aspx"
useSmallMessages = false
channelId = (null)
connected = false
currentTarget = (mx.messaging.channels::AMFChannel)#4
eventPhase = 2
faultCode = "Channel.Call.Failed"
faultDetail = "NetConnection.Call.Failed: HTTP: Failed"
faultString = "error"
reconnecting = false
rejected = false
rootCause = (Object)#13
code = "NetConnection.Call.Failed"
description = "HTTP: Failed"
details = "http://localhost:37813/Web/Gateway.aspx?hostport=localhost:1179&https=N&id=-1"
level = "error"
target = (mx.messaging.channels::AMFChannel)#4
type = "channelFault"
timestamp = 0
timeToLive = 0
错误提示二
Error:(mx.messaging.messages::ErrorMessage)#0
body = (Object)#1
clientId = (null)
correlationId = "317CAADF-FB3D-1185-1D8D-6CCD9710D0CA"
destination = ""
extendedData = (null)
faultCode = "Client.Error.MessageSend"
faultDetail = "Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:3523/Web/Gateway.aspx'"
faultString = "发送失败"
headers = (Object)#2
messageId = "18754553-71FE-E1C6-A928-6CCD9AF88EB4"
rootCause = (mx.messaging.events::ChannelFaultEvent)#3
bubbles = false
cancelable = false
channel = (mx.messaging.channels::AMFChannel)#4
authenticated = false
channelSets = (Array)#5
connected = false
connectTimeout = -1
enableSmallMessages = true
endpoint = "http://localhost:3523/Web/Gateway.aspx"
failoverURIs = (Array)#6
id = (null)
mpiEnabled = false
netConnection = (flash.net::NetConnection)#7
client = (mx.messaging.channels::AMFChannel)#4
connected = false
maxPeerConnections = 8
objectEncoding = 3
proxyType = "none"
uri = "http://localhost:37813/Web/Gateway.aspx?hostport=localhost:3523&https=N&id=-1"
piggybackingEnabled = false
polling = false
pollingEnabled = true
pollingInterval = 3000
protocol = "http"
reconnecting = false
recordMessageSizes = false
recordMessageTimes = false
requestTimeout = -1
uri = "http://localhost:3523/Web/Gateway.aspx"
url = "http://localhost:3523/Web/Gateway.aspx"
useSmallMessages = false
channelId = (null)
connected = false
currentTarget = (mx.messaging.channels::AMFChannel)#4
eventPhase = 2
faultCode = "Channel.Connect.Failed"
faultDetail = "NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:3523/Web/Gateway.aspx'"
faultString = "error"
reconnecting = false
rejected = false
rootCause = (Object)#8
code = "NetConnection.Call.Failed"
description = "HTTP: Failed"
details = "http://localhost:37813/Web/Gateway.aspx?hostport=localhost:3523&https=N&id=-1"
level = "error"
target = (mx.messaging.channels::AMFChannel)#4
type = "channelFault"
timestamp = 0
timeToLive = 0
---------------------------------------------
首先,Flex与.NET的通信配置没有错,网关正确,因为这两种错误并不每次都出现。
错误提示一是当快速频繁点击按钮发送请求引起的。
错误提示二是关闭Flash Builder单独运行.NET中的flash页面引起的。
不难发现,这两个错误提示都具备一个共同点:http://localhost:37813/Web/Gateway.aspx?hostport=localhost:3523&https=N&id=-1
这个37813端口并不是我们自己设定的,是因为在使用Flash Builder过程中开启了网络监视器Network Monitor,我的理解是因为网络监视器需要监测返回服务器各方法返回的数据和信息,因此在37813这个端口同时进行访问。
因此,错误提示一的原因就是频繁进行数据交互使得网络监视器在没有完全记录上一轮操作的数据的情况下要同时开始新的记录,这个过程中可能导致负荷过重,因而报错。
错误提示二的原因则是,当Flash Builder关闭即没有程序运行网络监视器时,再访问37813端口就会出现问题。
----------------------
墨迹了这么半天,解决方案一目了然:
关闭网络监视器Network Monitor!
参考:
http://tcoztechwire.blogspot.com/2010/02/flash-builder-bug-services-failing-swf.html
http://blog.youkuaiyun.com/wuhualong1314/article/details/6574849