Is there any time it would not be a good idea to call web services async? My data layer is a REST-based interface and I thinking of adopting an async-only app开发者_开发百科roach to all the CRUD in the system. Is there anything I should know?
I guess not! After so many months of non-response, I guess I should just stay with my conclusion that it's all good ... if I can cope with the additional code complexity of handling async operations.
However, a proof of concept that puts some metrics around the difference using proper message size, data load and user load models, network infrastructure and server resources will be a very definitive approach.
You should be fine. Web calls are actually one of the major reasons that async is good. Since web calls can take quite a bit of time, you don't want that happening on the UI thread, as it's obviously going to block. The only things you need to worry about are the fact that you aren't going to be able to use session like you normally could (you CAN use sessionstate="readonly"), and certain types of I/O operations can still block, even if your code it set up to be async. But by and large you should be fine with the async approach.
精彩评论