Differences between Web service, WCF, WCF rest, Web API

Source: Internet
Author: User

In the. NET framework, there are many techniques for creating HTTP protocol-based services, such as Web service, WCF,WCF rest, Web API, and so on. There are a lot of articles on the internet to teach us how to develop and use these technologies, but it does not explain the relationship between them, after a period of access to information, my understanding is now organized as follows.

Web Service:

    1. Based on SOAP, only the HTTP protocol is supported.
    2. The data transfer format is XML.
    3. Can only be deployed on IIS.

Wcf:

    1. SOAP-based, supports multiple transport protocols such as HTTP,HTTPS,TCP,MSMQ, named Pipes, and so on.
    2. The data transfer format is XML.
    3. Service configuration is cumbersome.
    4. Can host in an application, IIS, or Windows service.

WCF rest:

    1. The webhttpbindings node needs to be configured.
    2. The data transfer format can be XML, JSON, Atom, and so on.
    3. HTTP GET and post operations are supported by default, and additional HTTP operations such as put, delete, and so on can be supported by extra configuration of acceptable request in IIS.
    4. The UriTemplate template must be specified when the parameter is passed in WebGet mode.

Web API:

    1. is a lightweight framework for building HTTP services, which is in the. NET platform, the ideal framework for building restful Web service.
    2. Compared to the WCF Rest service, the Web API provides all the features of HTTP, such as URIs, Request/response headers, caching, versioning, and various content format.
    3. It also supports MVC's features.
    4. Can host in the application and IIS.
    5. Applicable to a variety of clients, such as browsers, mobile apps, PC-side applications and so on.
    6. Response are serialized into JSON, XML, or other kinds of formats.

When to use WCF or Web APIs:

    1. Use WCF if you have the following special scenarios: one-way messages, Message Queuing, duplex communication, and so on.
    2. WCF is recommended when transmission channels are not limited to HTTP, such as TCP, UDP, and so on.
    3. The Web API is recommended when you want to create a resource-oriented service or want to support all of the features of HTTP.
    4. The Web API is recommended when you need to support multiple clients.

Differences between Web service, WCF, WCF rest, Web API

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.