Do you think ASP.NET MVC is able to develop RESTful web services and which approach you would use for it?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- Design RESTful service with multiple ids
- Axios OPTIONS instead of POST Request. Express Res
- Plain (non-HTML) error pages in REST api
- Laravel 5.1 MethodNotAllowedHttpException on store
相关文章
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
- Got ActiveRecord::AssociationTypeMismatch on model
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:
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.
Peter,
In response to calebjenkins, ADO.Net data services is really nice if you want to create a restful version of your database.
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.
I would seriously look at ADO.NET Dataservices. (formaly code named Astoria) There's some really nice tooling for Restful services in there!
http://msdn.microsoft.com/en-us/data/bb931106.aspx
see this http://msmvps.com/blogs/omar/archive/2008/10/03/create-rest-api-using-asp-net-mvc-that-speaks-both-json-and-plain-xml.aspx
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.
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.
As of MVC 4 Web API officially supports building RESTful web services.