By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,706 Members | 1,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,706 IT Pros & Developers. It's quick & easy.

Asynchronous long tasks in 2: WebService OneWay or Threads

P: 3

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 (

- 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 requests handeling threads?

-Q: In this article: 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?

Mar 27 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.