wcf - How to avoid block IO operation when responding a user's request in asp.net -
i working on wcf project hosted asp.net/iis. wcf service has method called searchimage, looks this:
string searchimage(string query) { //call bing service images //it time-consuming return result. }
the call bing service time consuming. can impact service much. async call doesn't here:
string searchimage(string query) { //async call bing service images waitforcomplete(); return result. }
you can see, still need wait until bing returns result.
my question is, there technology avoid kind of block io issue? ideally, want tell asp.net response when bing result back.
no. have return complete web page, javascript embedded (jquery popular, though atlas can integrate asp.net better) perform async call after page rendered, , replace relevant dom section (usually tagged css id) contents loaded. way, user sees loaded throbber, replaced final text, image, or whatever you're loading once it's ready.
you can make async call go server, can massaging server-side, that's worth effort. javascript can handle massaging need.
Comments
Post a Comment