进行HTTPWebRequest和事件(Erorr:底层连接已关闭:接收时发生意外错误)?

问题描述:

我有一个页面,使HTTPWebRequest到外部系统。外部页面处理请求并触发一些事件。我收到“底层连接已关闭:接收时出现意外错误。”事件发生时出错。如果我从页面中删除事件,一切工作正常。我想我可能对事件中的代码有问题(我现在还找不到任何东西),但我想看看是否有可能丢失的东西。由于进行HTTPWebRequest和事件(Erorr:底层连接已关闭:接收时发生意外错误)?

丹尼尔

更新02/11/2010上午09时56分: 有对事件没有任何错误。他们工作正常。下面是我使用发出请求的代码:

​​

有人曾提到的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