Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Asynchronous long tasks in Asp.net 2: WebService OneWay or Threads

Question posted by: sirmoreno (Newbie) on March 27th, 2008 11:26 AM
Hi,

In my web site I have some long tasks that I want to call without delaying the page rendering - without making the thread that handels the page request wait for the long task to end.

I found two solutions but I can't figure out which one is better?

1. Asynchronous OneWay WebService:

- Declare a OneWay method for the long task inside an asmx file in my website and WebReference it.

This way when I call the method the request thead can continue without waiting to the answer.

- Q: I don't know what is the overhead for using WebService? can I use it every time I get a request for a page?

- Q: If the WebService is on the same WebSite, does the request goes through the IIS? can this effect the scalability of my website?

2. Use Threads (http://www.codeproject.com/KB/cs/As...Invocation.aspx)

- Execute the long task in a separate thread by calling the method throught a delegate with BeginInvoke().

-Q: Does BeginInvoke() take a thread from the same thread pool of the asp.net requests handeling threads?

-Q: In this article: http://www.interact-sw.co.uk/iangbl...dinvokerequired it says that "EndInvoke() is Not Optional", But with EndInvoke() called the request thread waits for the long task to end. What is the price for not calling the EndInvoke?

Thanks.
Last edited by jhardman : April 1st, 2008 at 11:31 PM. Reason: moved to .Net forum. ASP forum is for "classic" ASP
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Reply
Not the answer you were looking for? Post your question . . .
169,970 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top .NET Forum Contributors