AngularJS-哪个是WCF Rest或Web API的好选择 [英] AngularJS - Which is good WCF Rest or Web API

查看:87
本文介绍了AngularJS-哪个是WCF Rest或Web API的好选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将开始一个与Microsoft .NET混合的新AngularJS项目.现在我很困惑,我应该选择WCF Rest还是Web API?

I'm going to start a new AngularJS Project blended with Microsoft .NET. Now I'm confused which one should I select, WCF Rest or Web API ?

我的Angular应用程序具有一个登录模块和一个主应用程序.只有经过身份验证的用户才能访问主应用程序.在Web API中,我们必须使用令牌系统或Owin Auth,但是一些博客说它不是那么安全.因此,我完全困惑,我应该选择哪个?哪一个有效且安全?

My Angular App has a Login Module and a Main Application. Only the authenticated user can access the Main Application. In Web API we have to use Token System or Owin Auth, but some blogs are saying its not so secure. So, I am totally confused which should I choose ? which one is efficient and secure ?

WCF休息

  1. 要将WCF用作WCF Rest服务,我们必须启用 webHttpBindings .
  2. 它通过 [WebGet] [WebInvoke] 支持HTTP GET和POST动词属性.
  3. 要启用其他HTTP动词,我们必须在IIS中进行一些配置接受.svc文件中特定动词的请求
  4. 使用 WebGet 通过参数传递数据需要配置.必须指定 UriTemplate
  5. 它支持XML,JSON和ATOM数据格式.
  1. To use WCF as WCF Rest service we have to enable webHttpBindings.
  2. It supports HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.
  3. To enable other HTTP verbs we have to do some configuration in IIS to accept request of that particular verb on .svc files
  4. Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified
  5. It supports XML, JSON and ATOM data format.

Web API

  1. 这是用于轻松便捷地构建HTTP服务的新框架简单的方法.
  2. Web API是开源的,是构建REST-ful的理想平台.NET Framework上的服务.
  3. 与WCF Rest服务不同,它使用HTTP的全部功能(例如URI,请求/响应头,缓存,版本控制,各种内容格式)
  4. 它还支持MVC功能,例如路由,控制器,动作结果,过滤器,模型绑定器,IOC容器或依赖项注入,单元测试,使其更简单,更强大.
  5. 它可以托管在应用程序中或IIS上.
  6. 它是轻量级架构,适合具有以下功能的设备带宽有限,例如智能手机.
  7. 响应由Web API的 MediaTypeFormatter 格式化为JSON,XML或要添加为 MediaTypeFormatter 的任何格式.
  1. This is the new framework for building HTTP services with easy and simple way.
  2. Web API is open source, an ideal platform for building REST-ful services over the .NET Framework.
  3. Unlike WCF Rest service, it uses the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats)
  4. 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.
  5. It can be hosted with in the application or on IIS.
  6. It is light weight architecture and good for devices which have limited bandwidth like smart phones.
  7. Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.

请帮助我,哪一个是有效和安全的?

Kindly assist me, which one is efficient and secure?

推荐答案

南希

Nancy

  1. 比web-api或WCF轻巧
  2. 基于公约的典礼
  3. 就HTTP支持而言,具有与WebAPI一样的功能
  4. 支持Razor视图引擎
  5. 支持OWIN管道
  6. 立即提供自己的IOC

这篇关于AngularJS-哪个是WCF Rest或Web API的好选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆