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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sirmoreno
    New Member
    • Feb 2008
    • 3

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

    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/Asy...nvocation.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/iangblo...invokerequired 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; Apr 1 '08, 11:31 PM. Reason: moved to .Net forum. ASP forum is for "classic" ASP
Working...