Difference between WCF and Web API and WCF REST and Web Service

Source: Internet
Author: User
Tags soap

The. Net framework has a number of technologies this allow you to create HTTP services such as Web Service, WCF and now We b API. There is a lot of articles over the internet which may describe to whom your should use. Now a days, you had a lot of choices to build HTTP services on the. NET framework. In this article, I would like to share my opinion with your over web Service, the WCF and now Web API. For more information about the Web API refers what is the Web API and why do I use it?.

Web Service
    1. It is based on SOAP and return data in XML form.

    2. It support is only HTTP protocol.

    3. It is not an open source but can be consumed by any client that understands XML.

    4. It can be hosted only on IIS.

Wcf
    1. It is also based on the SOAP and return data in XML form.

    2. It is the evolution of the Web Service (ASMX) and support various protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ.

    3. The main issue with WCF are, its tedious and extensive configuration.

    4. It is not an open source but can be consumed by any client that understands XML.

    5. It can be hosted with the applicaion or on IIS or using a window service.

WCF Rest
    1. To use WCF as WCF Rest service, you have the to enable webhttpbindings.

    2. It support HTTP GET and POST verbs by [webget] and [WebInvoke] attributes respectively.

    3. To enable the other HTTP verbs. Some configuration in IIS to accept request of this particular verb on. svc file S

    4. Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified

    5. It support XML, JSON and ATOM data format.

Web API
    1. The the new framework for building HTTP services with easy and simple.

    2. Web API is open source a ideal platform for building rest-ful services over the. NET Framework.

    3. Unlike WCF Rest service, it use the full featues of HTTP (like URIs, Request/response headers, caching, versioning, Variou s content formats)

    4. It also supports the MVC features such as routing, Controllers, action results, filter, model binders, IOC container or de pendency injection, unit testing that makes it more simple and robust.

    5. It can be hosted with the application or on IIS.

    6. It's light weight architecture and good for devices which has limited bandwidth like smart phones.

    7. Responses is formatted by Web API ' s mediatypeformatter into JSON, XML or whatever format you want to add as a mediatypefo Rmatter.

To whom choose between WCF or WEB API
    1. Choose WCF When do want to create a service that should support special scenarios such as one-to-do messaging, message Queu ES, duplex communication etc.

    2. Choose WCF when want to create a service that can use fast transport channels when available, such as TCP, Named Pipes , or maybe even UDP (in WCF 4.5), and your also want to the support HTTP when all other transport channels is unavailable.

    3. Choose Web API When you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, Request/response headers, caching, versioning, various content formats).

    4. Choose Web API When your want to expose your service to a broad range of clients including browsers, mobiles, iphone and TA Blets.

From http://www.dotnet-tricks.com/Tutorial/webapi/ Ji2x050413-difference-between-wcf-and-web-api-and-wcf-rest-and-web-service.html

Difference between WCF and Web API and WCF REST and Web Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.