I need to create a .Net api that will return JSON that will be used by mobile applications.
One approach is to just use an MVC app and have my controller return JSON, so going to a url.com/controller/action/params would give me my JSON.
I’ve heard that creating a WCF Service is also a good choice. I don’t know much at all about WCF, though.
Are there pros and cons to each one? Is one more reliable to be used as a service that returns JSON only?
Another contender is ASP.NET Web API which uses WCF in self hosted scenario.
There are pros and cons but it all depends what you need now vs. latter, what is your level of expertise, technology commitment and what are the design trade-offs.
It depends what you mean by reliable. One technology is not necessarily more or less reliable. There are many factors that go into reliability.
These are some of the few pros/cons in no particular order, preference or completeness.
ASP.Net MVC / WebApi / ServiceStack
Pros:
your model to JSON, XML, or some other format, and then write
the serialized data into the body of the HTTP response
message.)
Cons:
WCF
Pros:
Cons: