.net RESTful API 与 Web 服务 API
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1130288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RESTful API vs Web Service API
提问by Rhys Jones
I am looking at doing a small web application for learning purposes, using .NET. My conundrum is whether I should be exposing application logic to other sites and applications via a REST API, or a set of Web Services.
我正在考虑使用 .NET 制作一个用于学习目的的小型 Web 应用程序。我的难题是我是否应该通过 REST API 或一组 Web 服务向其他站点和应用程序公开应用程序逻辑。
I am familiar with web services, but have not worked with REST. I understand the concepts of REST, I just have no practical experience with it.
我熟悉网络服务,但没有使用过 REST。我了解 REST 的概念,我只是没有实际经验。
Why would I use REST instead of web services for this scenario? Or not? What the issues that I should be mindful of when designing a REST API, particularly with .NET?
为什么我要在这种情况下使用 REST 而不是 Web 服务?或不?在设计 REST API 时,我应该注意哪些问题,尤其是 .NET?
采纳答案by VolkerK
回答by Daniel Brückner
.NET offers frameworks for both cases - Windows Communication Foundation for web services and ADO.NET Data Services for a REST API.
.NET 为这两种情况提供了框架 - 用于 Web 服务的 Windows Communication Foundation 和用于 REST API 的 ADO.NET 数据服务。
Both technologies are equaly powerful, but personaly I think a REST API is a smarter, cleaner solution. It ís somewhat more lightweight.
这两种技术同样强大,但我个人认为 REST API 是一种更智能、更简洁的解决方案。它更轻一些。
Further ADO.NET Data Services has the advantage that is very easy to get data from the database to the front end - even complete object graphs. A big win if you design a datacentric application.
此外,ADO.NET 数据服务还有一个优势,就是很容易从数据库中获取数据到前端——甚至是完整的对象图。如果您设计以数据为中心的应用程序,那将是一个巨大的胜利。

