ASP.NET MVC 4 Web Api和REST经典服务之间的区别

时间:2022-10-10 03:29:52

I saw that ASP.Net MVC4 WebApi exposes services as a Rest ones.

我看到ASP.Net MVC4 WebApi将服务公开为Rest服务。

But what is actually the difference between normal Rest and ASP.Net MVC4 WebApi?

但是正常的Rest和ASP.Net MVC4 WebApi实际上有什么区别?

2 个解决方案

#1


9  

I'm not sure what you mean by normal Rest.

我不确定你的正常休息是什么意思。

REST is a paradigm.

REST是一种范例。

HTTP is a protocol that follows that paradigm.

HTTP是遵循该范例的协议。

ASP.NET Web API allows developers to write ASP.NET applications that can be accessed via HTTP and adhere to the REST paradigm. While you could create a REST API without Web API, Web API provides a ton of features that will remove a lot of the pain associated with creating a truly RESTful API in ASP.NET.

ASP.NET Web API允许开发人员编写可以通过HTTP访问并遵守REST范例的ASP.NET应用程序。虽然您可以在没有Web API的情况下创建REST API,但Web API提供了大量功能,这些功能将消除与在ASP.NET中创建真正RESTful API相关的许多痛苦。

apigee has many great resources for REST API best practicies.

apigee为REST API最佳实践提供了许多很好的资源。

#2


2  

Are you asking about the general REST standard or the way that REST has been done traditionally on the Microsoft platform prior to the MVC4 Web API? I am thinking you are approaching this as the second one.

您是否询问了一般REST标准或传统上在MVC4 Web API之前在Microsoft平台上完成REST的方式?我在想你是第二个接近这个。

The updated approach in MVC4 gives you more REST capabilities without the WCF model. Here is a recent post on the subject: http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx.

MVC4中的更新方法为您提供了更多的REST功能,而无需WCF模型。以下是关于该主题的最新帖子:http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx。

#1


9  

I'm not sure what you mean by normal Rest.

我不确定你的正常休息是什么意思。

REST is a paradigm.

REST是一种范例。

HTTP is a protocol that follows that paradigm.

HTTP是遵循该范例的协议。

ASP.NET Web API allows developers to write ASP.NET applications that can be accessed via HTTP and adhere to the REST paradigm. While you could create a REST API without Web API, Web API provides a ton of features that will remove a lot of the pain associated with creating a truly RESTful API in ASP.NET.

ASP.NET Web API允许开发人员编写可以通过HTTP访问并遵守REST范例的ASP.NET应用程序。虽然您可以在没有Web API的情况下创建REST API,但Web API提供了大量功能,这些功能将消除与在ASP.NET中创建真正RESTful API相关的许多痛苦。

apigee has many great resources for REST API best practicies.

apigee为REST API最佳实践提供了许多很好的资源。

#2


2  

Are you asking about the general REST standard or the way that REST has been done traditionally on the Microsoft platform prior to the MVC4 Web API? I am thinking you are approaching this as the second one.

您是否询问了一般REST标准或传统上在MVC4 Web API之前在Microsoft平台上完成REST的方式?我在想你是第二个接近这个。

The updated approach in MVC4 gives you more REST capabilities without the WCF model. Here is a recent post on the subject: http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx.

MVC4中的更新方法为您提供了更多的REST功能,而无需WCF模型。以下是关于该主题的最新帖子:http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx。