Firsty We have to Understand What is WCF ? WCF stands for Windows Communication Foundation is also used for creating RestFul and Non Restful services like SOAP Services.WCF is mainly used for creating services that are protocol independent or transport independent. For example if we have a scenario in which we have two clients one is .NET client and other one is JAVA client and both the clients want to access a single WCF service with diffrent protocol and message formates like JAVA Client wants Transport Protocol as HttP and message format XML for his simplicity whereas .NET Client want transport protocol to be TCP and message formate to be Binary for the performance point of view so in this scenario we Create a Single WCF service with two endpoints one for each client.
Below figure shows Single WCF Service with two End Points.
WCF does not provides any MVC type support whereas Web API supports MVC type architecture support.
WCF is best suitable choice if you are using .NET 3.5.
WCF supports multiple transport protocols like TCP,UDP and Named Pipes.Whereas WEB API supports only HTTP Protocols only.
WEB API supports convention based CRUD operations with the help of HTTP Verbs like GET,PUT,POST and Delete.
WEB API provides support for Content Negotiation like provides choice for JSON/XML/Other Formates for response.
WEB API is Tightly coupled with HTTP.
WCF is better options when you want Serialization for the data over the network.
WCF has rich data contract and it is easy to self hosting.
WEB API is completely Open Source so it is better choice for creating Restful Services over the .NET Framework.
No comments:
Post a Comment