REST web services using MVC, is that a good idea?

In .Net, I think of the web service as the type of project you select from the menu, define your classes and methods, then .Net does all this black magic under the hood to allow someone on the other side of the world to reference to my web service and start coding using my classes and methods directly in their visual studio.

So, having this biased concept, when you look at creating REST web services using MVC 3 (I know that MVC 4 has REST api baked in, but I'm waiting for the full version), I’m interested in all the usual things like β€œthis is a good idea "," will it persist in use "and" I am just writing a game in web services that other developers will laugh. "

Now I think that my concern is probably due to the fact that Microsoft did not wrap the large, too complex, bloated, brilliant REST package. So I want my worries to be released, hopefully people tell me that MVC web services are great things to create.

Any help?

+7
source share
5 answers

I have done this several times, I still use it in production and have no complaints. I actually consider it a good solution, because it is so easy to set up and maintain. Not this incredibly heavy wcf file with xml configuration.

+5
source

You might also want to check out the WebAPI stuff that is in the process of being released (.net 4.5):

http://weblogs.asp.net/scottgu/archive/2012/02/23/asp-net-web-api-part-1.aspx

This is due to the exposure of simple html services.

+4
source

I would advise you to take a look at ServiceStack: http://www.servicestack.net/ . Not only is it mature enough, but it can help you create cleaner code.

+4
source

It really depends on what you plan to do with your application. Yes, you could write an MVC website that doubles as a RESTful service. However, you snap your user interface layer very close to your logical level, and this is what you really need to consider. I am working on an MVC site with ServiceStack REST (already mentioned by @Ioannis) . The reason I did not make MVC my REST service was because I did not want any changes to my user interface to affect any third-party application that could use my logical service. Therefore, if you carefully study the consequences of creating your website and your RESTful service, then any solution may be in order. :)

+3
source

As mentioned here, ServiceStack provides a simple, short-lived REST Web Services Framework that allows you to easily create typed, idiomatic C # API end-to-end.

ServiceStack also includes a number of high-performance components that integrate deeply with ASP.NET MVC using the ServiceStack.Host.Mvc NuGet package.

To learn more about the benefits that ServiceStack can add to your MVC project, see: http://www.servicestack.net/mvc-powerpack/

+1
source

All Articles