WCF的Web API和ASP.NET MVC JSON Web服务 [英] WCF Web API vs ASP.NET MVC JSON web services
问题描述
什么是新的使用WCF的Web API在ASP.NET MVC 3,露出一个轻量级的JSON Web服务层的优势在哪里?
我喜欢在许多方面网页API,但缺点是,它不上单工作,而MVC 3一样。什么是两种方法之间的主要区别?
What is the advantage of using new WCF Web API over ASP.NET MVC 3 to expose a lightweight JSON Web service layer? I like Web API in many ways, but the drawback is that it doesnt work on mono, while MVC 3 does. What are the major differences between the two approaches?
推荐答案
这是微软的认可,有两种产品之间有一些重叠。但是,它们有不同的重点:
It is recognized by Microsoft, that there is some overlap between the two products. However, they do have a different focus:
-
如果你正在建设一个网站,从您的Web服务使用JSON然后MVC可能是最好的选择。
If you are building a web site that consumes JSON from your web service then MVC is probably the best choice.
如果你正在建立旨在通过各种第三方客户端消费的API,然后WCF的Web API是最好的选择。
If you are building an API intended to be consumed by a variety of third party clients then WCF Web API is the best choice.
我个人的原因包括与WCF的Web API意味着我可以自托管在Windows服务中,我也能避免ASP.NET,web.config文件和卡西尼的事实: - )
My own personal reasons include the fact that with WCF Web API means I can self-host in a Windows service, and I can avoid ASP.NET, web.config and Cassini :-)
这篇关于WCF的Web API和ASP.NET MVC JSON Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!