What is difference between WCF and Web API?

What is difference between WCF and Web API?

KEY DIFFERENCE WCF is used for developing SOAP-based services whereas Web API is used for both SOAP-based and RESTful services. WCF does not offer any support for MVC features whereas Web API supports MVC features. WCF supports HTTP, UDP, and custom transport protocol whereas Web API supports only HTTP protocol.

What is WebServiceHost?

WebServiceHost automatically disables the HTTP Help page and the WSDL GET functionality so that the metadata endpoint does not interfere with the default HTTP endpoint. WebServiceHost checks all endpoints that use the WebHttpBinding to see if they have the required WebHttpBehavior.


Normally, a WCF service will use SOAP, but if you build a REST service, clients will be accessing your service with a different architectural style (calls, serialization like JSON, etc.). Exposing a WCF service with both SOAP and REST endpoints, requires just a few updates to the codebase and configuration.

Why Web API is better than WCF?

WEB API is a better choice for simpler, light weight services. WEB API can use any text format including XML and is faster than WCF. WEB API can be used to create full-blown REST Services….Advantages of WEB API over WCF.

Content format Any media format SOAP+XML
Service interface URL Patterns, HTTP methods Service contracts

Is WCF supported in .NET core?

NET Core and . NET 5 support calling WCF services, but won’t offer server-side support for hosting WCF. There are two recommended paths for modernizing WCF apps: gRPC is built on modern technologies and has emerged as the most popular choice across the developer community for RPC apps.

What is WSHttpBinding?

WSHttpBinding : Allows you to use various WS-* specifications such as WS-Security 1.1, WS-Reliable Messaging etc. It supports SOAP 1.2 as a messaging protocol. As its built using WS-* specifications, it does not support wider ranges of client.

Is system ServiceModel a WCF?

BasicHttpBinding Class (System.ServiceModel) Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate with ASMX-based Web services and clients and other services that conform to the WS-I Basic Profile 1.1.

Does Web API replace WCF?

The programming model of ASP.NET Web API resembles ASP.NET MVC in being simple, instead of requiring you to define interfaces, create implementation classes, and decorate them with several attributes. However, the ASP.NET Web API is not supposed to replace WCF anymore.