Do you think ASP.NET MVC is able to develop RESTful web services and which approach you would use for it?
您是否认为ASP.NET MVC能够开发RESTful Web服务以及您将使用哪种方法?
6 个解决方案
#1
15
I have written a whole series of posts on developing a RESTful Web Service using ASP.Net MVC... well at least I'm 80% of the way through after 8 posts. Have a look at:
我已经编写了一系列关于使用ASP.Net MVC开发RESTful Web服务的帖子......至少在8篇帖子之后我已经完成了80%。看一下:
http://shouldersofgiants.co.uk/blog/
http://shouldersofgiants.co.uk/blog/
The web service I'm developing supports multiple representations (XHTML / JSON / XML / HELP) handles as many possible errors as I could find and supports POST overloading.
我正在开发的Web服务支持多种表示(XHTML / JSON / XML / HELP)处理尽可能多的错误,因为我可以找到并支持POST重载。
#2
4
请参阅http://msmvps.com/blogs/omar/archive/2008/10/03/create-rest-api-using-asp-net-mvc-that-speaks-both-json-and-plain-xml。 ASPX
#3
3
Generally, I would say yes it is possible for ASP.Net MVC to develop RESTful web services. However, many times the consumers of the data are unique enough where this may not be the best approach.
一般来说,我会说是的,ASP.Net MVC可以开发RESTful Web服务。然而,很多时候数据的消费者是足够独特的,这可能不是最好的方法。
For larger application services or more complex services, I would recommend developing your MVC Controllers in a RESTful manner to be consumed by the views as MVC is designed. I would then think about ADO.Net Data Services or WCF for large scale data services.
对于更大的应用程序服务或更复杂的服务,我建议以RESTful方式开发MVC控制器,以便在设计MVC时由视图使用。然后我会考虑ADO.Net数据服务或WCF用于大规模数据服务。
#4
2
Peter,
彼得,
In response to calebjenkins, ADO.Net data services is really nice if you want to create a restful version of your database.
为了回应calebjenkins,如果你想创建一个宁静的数据库版本,ADO.Net数据服务真的很棒。
If you want more control over your restful webservice then i would use WCF web services. Or if your datastore isn't a database, then ADO.NET data service isn't really the right solution. Here is a really nice article which got me started.
如果您想要更多地控制您的restful webservice,那么我将使用WCF Web服务。或者,如果您的数据存储区不是数据库,那么ADO.NET数据服务实际上并不是正确的解决方案。这是一篇非常好的文章让我开始。
#5
2
As of MVC 4 Web API officially supports building RESTful web services.
从MVC 4开始,Web API正式支持构建RESTful Web服务。
#6
0
I would seriously look at ADO.NET Dataservices. (formaly code named Astoria) There's some really nice tooling for Restful services in there!
我会认真看看ADO.NET Dataservices。 (形式代码名为Astoria)在那里有一些非常好的Restful服务工具!
http://msdn.microsoft.com/en-us/data/bb931106.aspx
http://msdn.microsoft.com/en-us/data/bb931106.aspx
#1
15
I have written a whole series of posts on developing a RESTful Web Service using ASP.Net MVC... well at least I'm 80% of the way through after 8 posts. Have a look at:
我已经编写了一系列关于使用ASP.Net MVC开发RESTful Web服务的帖子......至少在8篇帖子之后我已经完成了80%。看一下:
http://shouldersofgiants.co.uk/blog/
http://shouldersofgiants.co.uk/blog/
The web service I'm developing supports multiple representations (XHTML / JSON / XML / HELP) handles as many possible errors as I could find and supports POST overloading.
我正在开发的Web服务支持多种表示(XHTML / JSON / XML / HELP)处理尽可能多的错误,因为我可以找到并支持POST重载。
#2
4
请参阅http://msmvps.com/blogs/omar/archive/2008/10/03/create-rest-api-using-asp-net-mvc-that-speaks-both-json-and-plain-xml。 ASPX
#3
3
Generally, I would say yes it is possible for ASP.Net MVC to develop RESTful web services. However, many times the consumers of the data are unique enough where this may not be the best approach.
一般来说,我会说是的,ASP.Net MVC可以开发RESTful Web服务。然而,很多时候数据的消费者是足够独特的,这可能不是最好的方法。
For larger application services or more complex services, I would recommend developing your MVC Controllers in a RESTful manner to be consumed by the views as MVC is designed. I would then think about ADO.Net Data Services or WCF for large scale data services.
对于更大的应用程序服务或更复杂的服务,我建议以RESTful方式开发MVC控制器,以便在设计MVC时由视图使用。然后我会考虑ADO.Net数据服务或WCF用于大规模数据服务。
#4
2
Peter,
彼得,
In response to calebjenkins, ADO.Net data services is really nice if you want to create a restful version of your database.
为了回应calebjenkins,如果你想创建一个宁静的数据库版本,ADO.Net数据服务真的很棒。
If you want more control over your restful webservice then i would use WCF web services. Or if your datastore isn't a database, then ADO.NET data service isn't really the right solution. Here is a really nice article which got me started.
如果您想要更多地控制您的restful webservice,那么我将使用WCF Web服务。或者,如果您的数据存储区不是数据库,那么ADO.NET数据服务实际上并不是正确的解决方案。这是一篇非常好的文章让我开始。
#5
2
As of MVC 4 Web API officially supports building RESTful web services.
从MVC 4开始,Web API正式支持构建RESTful Web服务。
#6
0
I would seriously look at ADO.NET Dataservices. (formaly code named Astoria) There's some really nice tooling for Restful services in there!
我会认真看看ADO.NET Dataservices。 (形式代码名为Astoria)在那里有一些非常好的Restful服务工具!
http://msdn.microsoft.com/en-us/data/bb931106.aspx
http://msdn.microsoft.com/en-us/data/bb931106.aspx