IHttpAsyncHandler.EndProcessRequest not being called

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?U3RldmUgV3JpZ2h0?=

    IHttpAsyncHandler.EndProcessRequest not being called

    Hi All,

    This is my first time using this interface, so I am sure I am just missing
    something stupid. When my Http Handler gets called, the Begin runs and the
    delegate runs, but the EndProcessReque st never runs and the page hangs
    forever. Any idea why?

    Public Class MyAsyncWebHandl er
    Implements IHttpAsyncHandl er
    Implements IReadOnlySessio nState

    Public Sub ProcessRequest( ByVal context As HttpContext) Implements
    IHttpHandler.Pr ocessRequest
    ' not called
    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements
    IHttpHandler.Is Reusable
    Get
    Return True
    End Get
    End Property

    ' Define the private Async method Delegate
    Private Delegate Sub AsyncProcessReq uest(ByVal context As HttpContext)

    Public Function BeginProcessReq uest( _
    ByVal context As HttpContext, ByVal cb As AsyncCallback,
    ByVal state As Object) _
    As IAsyncResult Implements
    IHttpAsyncHandl er.BeginProcess Request

    Dim dlgt As New AsyncProcessReq uest(AddressOf DoMyStuff)
    Return dlgt.BeginInvok e(context, Nothing, Nothing)
    End Function

    Public Sub EndProcessReque st(ByVal ar As IAsyncResult) Implements
    IHttpAsyncHandl er.EndProcessRe quest
    Dim dlgt As AsyncProcessReq uest = DirectCast(Dire ctCast(ar,
    AsyncResult).As yncDelegate, AsyncProcessReq uest)
    dlgt.EndInvoke( ar)
    End Sub

    Public Sub DoMyStuff(ByVal context As HttpContext)
    Threading.Threa d.Sleep(3000)
    End Sub

    End Class

    Thanks,

    --
    Steve Wright, MCSD, MCDBA, MCSE
    Microsoft Architect
    MSI - Omaha, NE
  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: IHttpAsyncHandl er.EndProcessRe quest not being called

    is your async code async? is it calling SetCompleted()?


    -- bruce (sqlwork.com)


    "Steve Wright" wrote:
    Hi All,
    >
    This is my first time using this interface, so I am sure I am just missing
    something stupid. When my Http Handler gets called, the Begin runs and the
    delegate runs, but the EndProcessReque st never runs and the page hangs
    forever. Any idea why?
    >
    Public Class MyAsyncWebHandl er
    Implements IHttpAsyncHandl er
    Implements IReadOnlySessio nState
    >
    Public Sub ProcessRequest( ByVal context As HttpContext) Implements
    IHttpHandler.Pr ocessRequest
    ' not called
    End Sub
    >
    Public ReadOnly Property IsReusable() As Boolean Implements
    IHttpHandler.Is Reusable
    Get
    Return True
    End Get
    End Property
    >
    ' Define the private Async method Delegate
    Private Delegate Sub AsyncProcessReq uest(ByVal context As HttpContext)
    >
    Public Function BeginProcessReq uest( _
    ByVal context As HttpContext, ByVal cb As AsyncCallback,
    ByVal state As Object) _
    As IAsyncResult Implements
    IHttpAsyncHandl er.BeginProcess Request
    >
    Dim dlgt As New AsyncProcessReq uest(AddressOf DoMyStuff)
    Return dlgt.BeginInvok e(context, Nothing, Nothing)
    End Function
    >
    Public Sub EndProcessReque st(ByVal ar As IAsyncResult) Implements
    IHttpAsyncHandl er.EndProcessRe quest
    Dim dlgt As AsyncProcessReq uest = DirectCast(Dire ctCast(ar,
    AsyncResult).As yncDelegate, AsyncProcessReq uest)
    dlgt.EndInvoke( ar)
    End Sub
    >
    Public Sub DoMyStuff(ByVal context As HttpContext)
    Threading.Threa d.Sleep(3000)
    End Sub
    >
    End Class
    >
    Thanks,
    >
    --
    Steve Wright, MCSD, MCDBA, MCSE
    Microsoft Architect
    MSI - Omaha, NE

    Comment

    • =?Utf-8?B?U3RldmUgV3JpZ2h0?=

      #3
      RE: IHttpAsyncHandl er.EndProcessRe quest not being called


      Thanks, Bruce.

      I found that my problem was that I forgot to pass the callback when I did
      the begin.

      This:
      Return dlgt.BeginInvok e(context, Nothing, Nothing)

      should have been this:
      Return dlgt.BeginInvok e(context, cb, Nothing)

      When would I call SetComplete()? I am not familiar with that.

      Thanks for your help,

      --
      Steve Wright, MCSD, MCDBA, MCSE
      Microsoft Architect
      MSI - Omaha, NE


      "bruce barker" wrote:
      is your async code async? is it calling SetCompleted()?
      >
      >
      -- bruce (sqlwork.com)
      >

      Comment

      Working...