I’m developing and ASP.Net MVC 3 website.
I’ve to give an access on some function through a webservice.
- Is there a way to directly do this in Asp:net MVC 3 ? (e.g. with
a special controler? where all my action would be an available
action of the controller) - If yes, is this recommend?
- Otherwise I will create a WCF service, but is this possible and/or recommanded
to host it in an Asp.Net MVC application? I need to have the
webservice accessible on the same domain/port than the main website.
How can I do this?
Thank you very much
A) Yes, there is, this CodeProject outlines a RESTful service with MVC 3. Although, the nicest way to do that is with Web API, which is part of MVC4.
B) Yes it is a good way to create a RESTful service with MVC. The question of whether you need a RESTful service depends on the project.
C) I’ve never seen that, and while it may be possible I’d prefer to keep the two in separate projects and app pools.