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 EndProcessRequest never runs and the page hangs
forever. Any idea why?
Public Class MyAsyncWebHandler
Implements IHttpAsyncHandler
Implements IReadOnlySessionState
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
' not called
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return True
End Get
End Property
' Define the private Async method Delegate
Private Delegate Sub AsyncProcessRequest(ByVal context As HttpContext)
Public Function BeginProcessRequest( _
ByVal context As HttpContext, ByVal cb As AsyncCallback,
ByVal state As Object) _
As IAsyncResult Implements
IHttpAsyncHandler.BeginProcessRequest
Dim dlgt As New AsyncProcessRequest(AddressOf DoMyStuff)
Return dlgt.BeginInvoke(context, Nothing, Nothing)
End Function
Public Sub EndProcessRequest(ByVal ar As IAsyncResult) Implements
IHttpAsyncHandler.EndProcessRequest
Dim dlgt As AsyncProcessRequest = DirectCast(DirectCast(ar,
AsyncResult).AsyncDelegate, AsyncProcessRequest)
dlgt.EndInvoke(ar)
End Sub
Public Sub DoMyStuff(ByVal context As HttpContext)
Threading.Thread.Sleep(3000)
End Sub
End Class
Thanks,
--
Steve Wright, MCSD, MCDBA, MCSE
Microsoft Architect
MSI - Omaha, NE 2 3321
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 EndProcessRequest never runs and the page hangs
forever. Any idea why?
Public Class MyAsyncWebHandler
Implements IHttpAsyncHandler
Implements IReadOnlySessionState
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
' not called
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return True
End Get
End Property
' Define the private Async method Delegate
Private Delegate Sub AsyncProcessRequest(ByVal context As HttpContext)
Public Function BeginProcessRequest( _
ByVal context As HttpContext, ByVal cb As AsyncCallback,
ByVal state As Object) _
As IAsyncResult Implements
IHttpAsyncHandler.BeginProcessRequest
Dim dlgt As New AsyncProcessRequest(AddressOf DoMyStuff)
Return dlgt.BeginInvoke(context, Nothing, Nothing)
End Function
Public Sub EndProcessRequest(ByVal ar As IAsyncResult) Implements
IHttpAsyncHandler.EndProcessRequest
Dim dlgt As AsyncProcessRequest = DirectCast(DirectCast(ar,
AsyncResult).AsyncDelegate, AsyncProcessRequest)
dlgt.EndInvoke(ar)
End Sub
Public Sub DoMyStuff(ByVal context As HttpContext)
Threading.Thread.Sleep(3000)
End Sub
End Class
Thanks,
--
Steve Wright, MCSD, MCDBA, MCSE
Microsoft Architect
MSI - Omaha, NE
Thanks, Bruce.
I found that my problem was that I forgot to pass the callback when I did
the begin.
This:
Return dlgt.BeginInvoke(context, Nothing, Nothing)
should have been this:
Return dlgt.BeginInvoke(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) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: beveled edges |
last post by:
I'm using the XML functions in PHP 5. The callback function I set for
namespace declarations doesn't get called. Can anyone help me out?
The code is:
$xml = '<addressbook...
|
by: beveled edges |
last post by:
I'm using the XML functions in PHP 5. The callback function I set for
namespace declarations doesn't get called. Can anyone help me out?
The code is:
$xml = '<addressbook...
|
by: Mike Grishaber |
last post by:
Hello All,
I am using an IHttpAsyncHandler class to intercept HTTP Requests and forward
them to a system which processes the Request and returns the Result.
I use .NET Remoting to connect the...
|
by: buzz |
last post by:
I am evaluating Mike Woodring's custom thread pool classes
(Developmentor) for use with an ASP.NET project that will be
implementing pages derived from IHttpAsyncHandler. (Recommended by the...
|
by: buzz |
last post by:
I am new to ASP.NET, so perhaps this is problem will yield a simple answer.
I am building an ASP.NET application using asynchronous handlers
(IHttpAsyncHandler). In doing so, it was recommended...
|
by: Brad Quinn |
last post by:
I have a question about the correct way to handle exceptions. Most of the
sample code I have seen doesn't address this.
My BeginProcessRequest looks like any other.
public IAsyncResult...
|
by: Charles Law |
last post by:
I have an application that creates a class. The class has unmanaged
resources, so must end gracefully.
How can I guarantee that the unmanaged resources are freed?
I have looked at IDisposable,...
|
by: Craig |
last post by:
Hi,
Is there a way to force a FIN packet back to the client in the
EndProcessRequest method? If not, could someone please explain how/why FIN
packets are generated.
Would appreciate any help....
|
by: =?Utf-8?B?Z2hhdXNl?= |
last post by:
I'm trying to stream in image from another domain asynchronously.
My ashx looks like this:
<%@ WebHandler Language="VB" Class="Handlers.AsyncImageHandler" Debug="true"
%>
Here is the vb:...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |