Async. Support

Topics: Web Api
Jan 28, 2011 at 12:44 AM

Is it possible to create async entrypoints for the APIs?

I'm thinking about BeginGet/EndGet() APIs rather than Get(), as my service may involve several high-latency asynchronous operations.

Jan 28, 2011 at 4:23 AM

Are you asking if it is possible to make an asynchronous HTTP GET request using the HTTP client?  If so then take a look at HttpClient.GetAsync().

 

Jan 28, 2011 at 7:04 PM

Hi Darrel, no. I'm asking if it's possible to have the following APIs in my HelloWorld service, for instance:

 

BeginHelloWorldGet()

EndHelloWorldGet()

Coordinator
Jan 28, 2011 at 7:17 PM

@ajthomas you can do that today in WCF as we support async operations.

http://msdn.microsoft.com/en-us/library/ms731177.aspx 

Jan 28, 2011 at 7:22 PM

Thanks Glenn. So in the example in http://wcf.codeplex.com/wikipage?title=Exposing%20a%20service%20over%20HTTP%20using%20HTTP%20Messages, would I basically have a BeginPost() and an EndPost() ? I just wanted to ensure I could still leverage WCF asynchrony with the HTTP service.

Coordinator
Jan 28, 2011 at 7:30 PM

I haven't tested yet, but it should work. It's a bit of a PITA though in that the signatures have to be EXACTLY right. When I have some time I will see if I can get it to work, that is unless you get there first :-)

Jan 29, 2011 at 12:42 AM

Coolio. Thanks Glenn. I'll check it out when I can. Right now, I'm just using vanilla WCF.