473,748 Members | 10,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IHttpAsyncHandl er.EndProcessRe quest 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
Jun 27 '08 #1
2 3345
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
Jun 27 '08 #2

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)
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1389
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 xmlns:ab="http://www.somewhere.com/addressbook/">' . '</addressbook>'; $parser = xml_parser_create_ns();
1
1804
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 xmlns:ab="http://www.somewhere.com/addressbook/">' . '</addressbook>'; $parser = xml_parser_create_ns();
0
3845
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 IHttpAsyncHandler object to the System and transfer the Request and Result between the two. This works fine for quite a while, and then I start to get the following error. "This remoting proxy has no channel sink which means either the server has
1
2140
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 famous Fritz Onion article on IHttpAsyncHandler...) I understand most of the code, however I am at a losss of the purpose of the ThreadInfo class. It appears that it is used to get the current HTTP context object for a worker thread?? But, can't...
0
1266
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 that I use a custom thread pool to handle work items that are queued from BeginProcessRequest. I am using the famous DevelopMentor custom thread pool written by Mike Woodring.
0
1061
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 BeginProcessRequest(HttpContext ctx,AsyncCallback cb,object obj) { AsyncRequestState reqState = new AsyncRequestState(ctx, cb, obj); _threadPool.PostRequest(new WorkRequestDelegate(this.AsyncProcessRequest),
20
7516
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, but this seems to rely on a call from the application, e.g. MyClass.Dispose()
1
1471
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. THanks you. Regards, CRaig
1
2567
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: Imports System.net imports system.io Namespace .Handlers
0
8823
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.