Create and Call an ASP.NET Asynchronous Web Service and call it from JavaScript
- by nickyt
Environment:
ASP.NET web applicaition
jQuery, ASP.NET AJAX
Currently using ASP.NET Web Services
The title says it all.
One, how do i create an ASP.NET web service that is asynchronous? I've seen many articles, that show example with IAsyncResult and BeginMyWebServiceMethod and EndMyWebServiceMethod, some using ThreadPool etc.
I would just like to know what is the simplest way to make an asynchronous web service method call (ideally without having to implement other classes, if possible). To me it should be as simple as adding an attribute to the method (but I think that is wishful thinking), e.g.
public SomeWebService : WebService
{
[Asynchronous]
public static bool SomeCheck()
{
// code
}
}
I'm open to using WCF if that makes it easier (we converted to ASP.NET 3.5 around Christmas time).
Once I have the asynchronous web service created, what is the best way to call it from client-side script? Via jQuery's $ajax or ASP.NET's auto generated class for a web service that is script method?