zoukankan      html  css  js  c++  java
  • WCF、Web API、WCF REST、Web Service之区别

    http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.html

     .NET framework 有很多的技术来创建HTTP service,比如:Web Service, WCF 和Web API。下面讲述一下它们的区别:

    Web Service

    • 基于SOAP,并且返回XML数据。
    • 只支持HTTP协议。
    • 非开源,但是xml能够被所有的客户端理解并使用。
    • 只能驻留在IIS中。

    WCF

    • 同样基于SOAP,并且返回XML数据。
    • 是Web Service的演化版(ASMX)并且支持各种协议比如TCP, HTTP, HTTPS, Named Pipes, MSMQ。
    • WCF主要的问题是繁琐的、可扩展的配置。
    • 非开源,但是xml能够被所有的客户端理解并使用。
    • 能够在IIS中或者其它的window service(window 服务)中驻留。

    WCF REST

    • 将WCF作为WCF Rest Service,你必须支持webHttpBinding。
    • 它支持 HTTP GET和POST。
    • 如果要支持其它的HTTP verbs,你必须设置IIS使其能接受其它的verb。
    • Passing data through parameters using a WebGet need configuration. The UriTemplate must be specified.
    • 支持XML、JSON和ATOM数据格式。

    Web API

    • This is the new framework for building HTTP services with easy and simple way.
    • Web API is open source an ideal platform for building REST-ful services over the .NET Framework.
    • Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats)
    • It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.
    • It can be hosted with in the application or on IIS.
    • It is light weight architecture and good for devices which have limited bandwidth like smart phones.
    • Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter
  • 相关阅读:
    【Python】使用socketserver建立一个异步TCP服务器
    阻塞式I/0 和 非阻塞式I/O 同步异步详细介绍
    练习题|并发编程
    log4j写数据库存在单引号问题
    javascript复制网页表格内容
    在cxf中使用配置避免增加字段导致客户端必须更新的问题
    启用了不安全的 HTTP 方法
    会话标识未更新
    跨站点请求伪造
    java操作properties文件
  • 原文地址:https://www.cnblogs.com/AllanDragoon/p/4285421.html
Copyright © 2011-2022 走看看