Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is difference with WCF and other web services?

Tags:

asp.net

wcf

asmx

I'm confused with WCF and other web services (such as asp.net ASMX,.net Remoting),can anybody tell me what is difference with WCF and the others and when should I use it, thanks!

like image 498
leo Avatar asked Jan 05 '09 10:01

leo


3 Answers

WCF is communication library that is superset of both .NET remoting and "old" ASMX web service and successor of both of these libraries.

WCF web services have much better support for WS-* standards and have less problems with interoperability.

Basically, you should use WCF since .net Remoting and ASMX might be considered legecy (and, if I recall correctly, some .NET remoting bugs were only fixed in WCF and never in .NET remoting itself)

like image 23
bh213 Avatar answered Nov 08 '22 19:11

bh213


WCF is a communication stack that allows services to be exposed over HTTP (like ASMX) and TCP (like Remoting) as well as Named Pipes (which is really an intra-machine cross process call), MSMQ and with .NET 3.5 REST.

It allows this because it's decoupled the communcation parts of the service away from the business logic. All you need to do is decorate your service classes, methods and DTO's with the appropriate contract attribute ([SeriviceContract], [OperationContract] and [DataContract] respectivly.)

This had the benefit of being able to write a service once, and allowing many different kinds of clients to consume the same service (i.e. Java clients can use HTTP, .NET clients can use TCP, legacy can use MSMQ, etc.).

WCF will still allow you do use all the features of each transport, including security, transactions, reliable messaging, etc., but you need to use some care. Not all features work on all transports, and you need to design accordingly. WCF allows you to specify in your contract which features are required. This prevents somone from trying to expose your service in a way that does not support the required feature set (i.e. if your service requires transactions, the WCF runtime will not allow the service to be accessed via a basic HTTP endpoint).

WCF is also extensible via custom behaviors (which influence how the WCF runtime works) and custom channels (which control how WCF services communicate with the outside world.)

WCF has a bit of a learning curve compared to ASMX, but the benefits ABSOLUTLY out weight this learning curve.

Hope that helps.

like image 102
James Bender Avatar answered Nov 08 '22 21:11

James Bender


I think it is fair to say that WCF replaces ASMX and remoting. You can achieve everything you could with ASMX and remoting and more with WCF, but you have a lot more capabilities and generally a lot more control over what's going on.

So I believe that, if you can, you should be using WCF.

like image 35
Yossi Dahan Avatar answered Nov 08 '22 21:11

Yossi Dahan