What better technology has replace ASMX web services on the MS platform? [closed]
Microsoft was pushing Windows Communication Foundation (WCF) a while back to replac开发者_StackOverflowe Web Services ASMX files but I'm not sure how successful that was at least at the beginning.
What is the preferred method to use now? Have newer versions of WCF gotten better to use? I am mostly both creating and consuming the web services I currently use in MS technologies.
WCF is the replacement for ASMX. There will be no further development for ASMX (except for bug fixes), while WCF is being improved (since it was released on .NET Framework 3.0 it's already got new features on 3.5 and 4.0). There's even a codeplex project which previews some of the upcoming features on the next releases at http://wcf.codeplex.com.
WCF has supplanted both ASMX web services and .NET Remoting. I believe it also wraps Enterprise Services (was COM+ / MTS) but I'm not 100% sure. In my experience, WCF is far easier than either ASMX or Remoting ever was. Part of that ease comes from the very straightforward approach... Define a contract (interface), define a service that implements this contract and optionally define objects that you can pass around.
WCF is pretty flexible in how these services can be hosted. In later versions the hosting and configuration options have improved.
As an aside, if you are both the provider and consumer of your services, WCF allows you the flexibility of choosing your transport regardless of your service logic. What I mean by that is that if you decide to choose a higher performing option that HTTP for your services (say, named pipes) you aren't stuck rewriting your asmx to another technology. A WCF service is agnostic of the transport - this is merely a configuration detail.
Also, REST should be mentioned. As it is all the rage these days, WCF supports the REST style of service implementation but in my opinion you'll be better served implementing a REST service API in ASP.NET MVC.
精彩评论