views:

51

answers:

1

I wonder if there are some differences between creating a WCF service and an MVC web-application.

If you know of good links on how to create such a service for an MVC application that returns a JSON object please do post them.

A: 

There is no difference in building WCF service for ASP.NET MVC. It is as any other REST service working with JSON. Check this article and included links.

The difference actually exists when you are building WCF service for ASP.NET AJAX (WebForms) because in that case you are adding support for ScriptManager by using EnableWebScript behavior instead of WebHttp behavior.

Ladislav Mrnka
I don't see the purpose of creting WCF AJAX Services, WHy should the Serivce bee in ajax, when the webbapllication takes care of the data and acts as ajax?
Troj
But it's not possible to create a .svc-file for a mvc webapplication?
Troj
The service is not in AJAX. The service can be called from JavaScript. Generally if you use ASP.NET MVC and you are happy with JsonResult you don't need WCF. You can't create svc file for MVC application but you can add AJAX enabled WCF service to MVC application.
Ladislav Mrnka