我有一个向外部系统发出HTTPWebRequest的页面。外部页面处理请求并在其一侧触发一些事件。我得到“底层连接已关闭:接收时发生意外错误。”触发事件时出错。如果我从页面中删除事件,一切正常。我想我可能在事件中遇到代码问题(我还找不到任何东西),但我想知道是否有什么东西可能会丢失。感谢
丹尼尔
更新02/11/2010上午9:56: 事件没有错误。他们工作正常。这是我用来发出请求的代码:
Dim req As HttpWebRequest = WebRequest.Create(url & "?" & _requestLength & "&isForward=1&rawResponse=" & RawResponse)
req.ProtocolVersion = New System.Version("1.0")
req.KeepAlive = False
Dim resp As HttpWebResponse = req.GetResponse()
'....log some of the response items.
resp.Close()
有人提到将HTTP版本设置为1.0而keepAlive设置为false,但这不起作用。
我在请求中调用标准ASPX页面。在该页面中,后面的代码是一个处理请求的类。该类有一些我在页面中连接的事件。以下是一个例子:
Partial Class RequestRedirect
Inherits System.Web.UI.Page
Private WithEvents theEvent As ClassEvents = Nothing
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
dim listener as new RequestListener(Request.Url.Query)
theEvent = listener.ClassEvents
listener.ProcessRequest()
End Sub
Protected Sub ProfileCreated(ByVal prq As ProfileRequest) Handles theEvent.Profile_CreatedEvent
dataAdapter.profileCreated(prq)
End Sub
End Class
答案 0 :(得分:0)
http://social.msdn.microsoft.com/Forums/en/vststest/thread/cbaa899a-170c-490b-8585-4613320b1ae2
http://geekswithblogs.net/Denis/archive/2005/08/16/50365.aspx
http://forums.asp.net/t/1114812.aspx
http://support.microsoft.com/kb/826210
http://chestermr.blogspot.com/2006/02/underlying-connection-was-closed.html
您使用的是加密吗?