Wrap the Application Service in ASMX or expose directly via WCF?
I have an application service layer (which all return serializable viewmodels). Some of these app services need to be callable via AJAX by client code in the Web UI. I'm currently wrapping them in ASMX files that do nothing but dictate 开发者_JAVA百科the response format as JSON delegate each call to the application service class with the same signature.
Is it advisable to try to save a few lines of code by exposing the appropriate application service classes as WCF services? Can someone point me to an example? Any potential pitfalls for usage in WebForms client code?
Microsoft now considers ASMX services to be "legacy technology". You should not use them for any new development. They have been completely replaced by WCF. For instance, see the top of this article: http://msdn.microsoft.com/en-us/library/bb885203.aspx:
This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation .
精彩评论