469,649 Members | 1,637 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

Calling Async object within a webservice method

Hi,

From reading various articles on scalability issues, I understand that there
is only a finite number of ASP.NET worker threads and any long running task
within ASP.NET should be fired off on a seperate thread using an async call.
All the articles I can find are either on implementing an async webpage, or
calling an async webservice. I can not however find any article on how to
make calls within a webservice asynchronous. Consider the following:

[WebMethod]
public int LongRunningTask(int inputValue)
{
BusinessObject bo = new BusinessObject();
return bo.Process(inputValue); // This typically takes 1-10 seconds,
but could take up to one minute!
}

Now "BusinessObject" implements the Microsoft "Asynchronous Design Pattern",
having "BeginProcess()" and "EndProcess()" methods, implementing callback,
IAsyncResult and state. But how do you call this in the web method? Is
there any way to hide the fact from the webservice consumer that the call to
the business object is asynchronous? Unlike Page, the base class WebService
doesn't appear to expose any ability to register call backs for any sort of
async call.

My gut feel is that the above is not possible, therefore I have to make the
webservice webmethod asynchronous (i.e. have webmethods
"BeginLongRunningTask" and "EndLongRunningTask"). How do I implement this,
hiding the non-async LongRunningTask() webmethod, as I won't want anyone to
consume that webmethod.

Regards,

- Paul.
Sep 17 '07 #1
0 1432

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Paul Hasell | last post: by
1 post views Thread by jens Jensen | last post: by
reply views Thread by Paul Hadfield | last post: by
1 post views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.