Async web request in asp.net httphandler?

I wouldn't use an Async Handler for this. Since you're not returning a result, using an Async Handler for this purpose is wasteful. You use an Aysnc handler in situations where the task you're doing is relatively long running and the result of this task has to be sent back as a response to the waiting thread and eventually the browser In your case you should use a secondary process or MSMQ to get the job done.

A simple solution would be to to post the data into a table and have another process process these records. MSMQ works really well for these situations since queuing a message takes a fraction of a second and the process that processes these messages can take it's own sweet time without any ill effects on your ASP. NET web application/site.

You'll get a lot of scalability of your website like this To answer your question about WaitHandle (if you're hell bent on going this route), no you shouldn't use the waithandle, you should use it as a true asynchronous non-blocking handler. WaitHandle will block There is no guarantee that the handler will be alive during the entire process. Your worker process can be reset during that time.

All the more reason to not do this as an Async Handler but rather as an "out of band" async job. By out of band I mean not in the same process as your ASP. NET application.

I wouldn't use an Async Handler for this. Since you're not returning a result, using an Async Handler for this purpose is wasteful. You use an Aysnc handler in situations where the task you're doing is relatively long running and the result of this task has to be sent back as a response to the waiting thread and eventually the browser.In your case you should use a secondary process or MSMQ to get the job done.

A simple solution would be to to post the data into a table and have another process process these records. MSMQ works really well for these situations since queuing a message takes a fraction of a second and the process that processes these messages can take it's own sweet time without any ill effects on your ASP.NET web application/site. You'll get a lot of scalability of your website like this.

To answer your question about WaitHandle (if you're hell bent on going this route), no you shouldn't use the waithandle, you should use it as a true asynchronous non-blocking handler. WaitHandle will block. There is no guarantee that the handler will be alive during the entire process.

Your worker process can be reset during that time. All the more reason to not do this as an Async Handler but rather as an "out of band" async job. By out of band I mean not in the same process as your ASP.

NET application.

Thank you for the useful reply. I will look into a MSMQ solution. – Raimone Feb 3 at 4:07.

I kind of understand how this is suppose to work but can't quite put it all together. NOTE: The handle is not used to intercept a web request. I am using the handler to process an ajax post.

I am calling the handler directly.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions